- Support forum for the WooCommerce Min Max Step Quantity Limits Manager.
Tagged: exclude user
- This topic has 6 replies, 2 voices, and was last updated 8 months, 2 weeks ago by Kousik.
-
AuthorPosts
-
January 31, 2024 at 1:59 pm #134079FirstClassReeceParticipant
Hello,
I want to exclude one specific user within a particular user role from product minimums. We set our minimums at the product level. I enabled the “users” section setting, Then edited her user and put it to -1. I tried setting the priority above and below the product-based priority, but everything seems to include that user in the minimums.
How can we exclude 1 user from having minimums within a specific user role when it is set at the product level?
Is there a hook or action or filter we can use to just unset the minimum quantity for a single user?Thank You
February 1, 2024 at 3:09 pm #134190KousikParticipantHello,
“Min Max Default Quantity for WooCommerce”
This plugin currently lacks the option to exclude a specific user; it can only exclude a user role.
Therefore, my suggestion is to create a custom user role, assign the specific user to that role, and then exclude the custom-created user role.
Soon, we plan to implement restrictions by user ID.
Regards
Kousik MukherjeeFebruary 1, 2024 at 4:03 pm #134192FirstClassReeceParticipantKousik,
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,
-ReeceMarch 20, 2024 at 9:31 am #137129KousikParticipantHello,
Apologies for the delayed response.
You can utilize this filter in your code:
function example_callback( $qty, $product_id ) { return $qty; } add_filter( 'alg_wc_pq_get_product_qty_min', 'example_callback', 10, 2 );
Regards,
Kousik Mukherjee- This reply was modified 8 months, 3 weeks ago by Kousik.
March 21, 2024 at 12:32 am #137174FirstClassReeceParticipantHello,
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?I just need a specific user ID to not be held to the minimum order quantity.
Thank You
March 21, 2024 at 12:49 am #137175FirstClassReeceParticipantHello,
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 ); }
March 26, 2024 at 6:33 pm #137668KousikParticipantHello FirstClassReece,
It appears that something might be amiss despite the filter code being correct. If you could send access to the admin at [email protected], we would be able to address and resolve this issue for you.
Regards,
Kousik Mukherjee -
AuthorPosts
- You must be logged in to reply to this topic.