$can = apply_filters( 'mam_wc_offers_user_can_manage_offer', $can, $offer_id, $user_id );
Runs on every accept/reject attempt, after the built-in decision. Built-in rules (deny-by-default):
- The target must be a real offer (
alg_wc_price_offerpost) and$user_idmust be a logged-in user. - Users with
manage_woocommerceare allowed. - With WooCommerce Product Vendors active, admins of the vendor in the offer’s
store_idmeta are allowed. - Everyone else is denied.
| Parameter | Type | Description |
|---|---|---|
$can |
bool | The built-in decision |
$offer_id |
int | The offer post ID |
$user_id |
int | The requesting app user |
Example: let the product’s author respond to offers on it
add_filter( 'mam_wc_offers_user_can_manage_offer', function ( $can, $offer_id, $user_id ) {
if ( $can ) {
return $can;
}
$product_id = get_post_meta( $offer_id, 'product_id', true );
$product = $product_id ? get_post( $product_id ) : null;
return $product && (int) $product->post_author === (int) $user_id;
}, 10, 3 );
Returning false here can also revoke the built-in grants for stricter sites.
