Max No of Items Filter Idling and Inner Workings
-
We are currently using this code to allow customers to buy max 5 items of products. It seem to work in the sense that once they add 6 is idles for a while and then shows 5 items were added and not more. Is this the way the filter works? Is there a way to just not allow the usage of let’s say 6? Two, is it normal for the system to stall? Are there specific memory needs perhaps?
// max 5 items for admin and customer // added 5.5 and 5 were added add_filter( 'alg_wc_pq_max_product_qty', 'my_product_qty_max_by_user_role', 10, 2 ); function my_product_qty_max_by_user_role( $qty, $product_id ) { $current_user = wp_get_current_user(); return ( in_array( 'customer, administrator', $current_user->roles ) ? 10 : $qty ); }
We would
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Max No of Items Filter Idling and Inner Workings’ is closed to new replies.