FirstClassReece

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • FirstClassReece
    Participant

    Hello,

    I’ve also tried this from somewhere else online, but still no luck. We set the minimum on the product level but need to exclude based on something else like user role, user ID, or something.

    add_filter( 'alg_wc_pq_get_product_qty_min', 'my_product_qty_min_by_user_role', 10, 2 );
    function my_product_qty_min_by_user_role( $qty, $product_id ) {
      $current_user = wp_get_current_user();
      return ( in_array( 'bedrijf', $current_user->roles ) ? 10 : $qty );
    }
    FirstClassReece
    Participant

    Hello,

    I have tried to add an exclusion based on user ID, but I haven’t had any luck. Here are some examples I tried since I don’t know exactly how this filter works.
    Is there any documentation to support this filter?

    https://pastebin.com/Bi1YPu7m

    I just need a specific user ID to not be held to the minimum order quantity.

    Thank You

    FirstClassReece
    Participant

    Kousik,

    Thank you for the response. However, this will not work because she needs to be in the user role to get her pricing.
    I tried creating another user role, with -1 set as the minimum, and giving her 2 user roles, but it does not unset the product minimum from her main user role.

    Is there a filter or action we can hook into to unset the product minimum? I can create my own snippet for her specific user ID to apply that filter to avoid her getting the minimums.

    Thanks,
    -Reece

Viewing 3 posts - 1 through 3 (of 3 total)