Filter: mam_wc_offers_user_can_manage_offer

$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):

  1. The target must be a real offer (alg_wc_price_offer post) and $user_id must be a logged-in user.
  2. Users with manage_woocommerce are allowed.
  3. With WooCommerce Product Vendors active, admins of the vendor in the offer’s store_id meta are allowed.
  4. 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.

Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!