How your plugin works?
-
Hi we use this code sippet
// remove old items in cart when new items added add_filter('woocommerce_add_to_cart_validation', 'remove_cart_item_before_add_to_cart', 1, 3); function remove_cart_item_before_add_to_cart($passed, $product_id, $quantity) { if (!WC()->cart->is_empty()) { WC()->cart->empty_cart(); } return $passed; }
to remove old products from the cart when someone adds to the cart a new product. This works ok.
We work with your plugin and added 3 virtual products to checkout with Upsell funnel (to sell them as extra services). When we click on one of these products it returns us an error message that the session expired.
We modifies our code to this
add_filter('woocommerce_add_to_cart_validation', 'remove_cart_item_before_add_to_cart', 1, 3); function remove_cart_item_before_add_to_cart($passed, $product_id, $quantity) { if (!is_checkout() && !WC()->cart->is_empty()) { WC()->cart->empty_cart(); } return $passed; }
so when is checkout page exclude the code but still do the same.
How does your plugin add products to the cart? Is possible to make this work somehow?
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How your plugin works?’ is closed to new replies.