Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Prevent Redirect after cart error
- add_filter( 'woocommerce_cart_redirect_after_error', '__return_false');
- add_action( 'woocommerce_add_to_cart_validation', 'restrict_only_one_item_in_cart' );
- function restrict_only_one_item_in_cart($cart_item_data) {
- global $woocommerce;
- $item_count = $woocommerce->cart->cart_contents_count;
- if($item_count >= 20){
- return false;
- }
- return $cart_item_data;
- }
- if((is_page('strongshop') || is_page('strongshopmobile')) && $item_count >= 20){
- return false;
Add Comment
Please, Sign In to add comment