Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Please Help
- This topic has 10 replies, 2 voices, and was last updated 5 years, 8 months ago by Noone.
-
AuthorPosts
-
April 2, 2018 at 10:02 pm #2905NooneParticipant
I got this plugin for a simple reason : to apply a 35% discount to the pizza category in the shop but only when one pizza is selected
I already have a bogo plugin im running pw logo and have this setup :
– It works when i choose just the pizza option and when i change the quantity to 2 it goes to bogo
THE ISSUE: im having is when one of the other products in the bogo are selected it still gives the precentage discount and not the bogo one as desired.
Please help!!!
April 2, 2018 at 10:11 pm #2906Soft79KeymasterI’m sorry, but I don’t understand your post very well. What bogo plugin are you using? What do you want to achieve with our plugin and what is failing? Please give an example or instructions to reproduce in your store.
April 2, 2018 at 10:34 pm #2907NooneParticipantOops here is what i want to achieve:
so i want to give 35% of the first pizza put into the cart
when someone adds another item or adds a second pizza i don’t want this to apply anymoreApril 2, 2018 at 10:36 pm #2908Soft79KeymasterSet Max Quantity of matching products to: 1
Then the discount will only apply if there is 1 matching item in the cart.
April 2, 2018 at 10:38 pm #2909NooneParticipantok and the other issue is:
I want it to apply when there is only one item not just a matching item
So example:
1 Pizza
1 DonairI do not want it to apply then
April 2, 2018 at 10:42 pm #2910Soft79KeymasterThat is not possible out of the box and would require a custom script to invalidate the coupon if amount of items in cart > 1
April 2, 2018 at 10:45 pm #2911NooneParticipantare you able to provide that by any chance please
I did so much work to try to do it without paying because im tight on funds
and i read a lot of reviews and read this on the details so i believed this can be achieved:Restrict coupon by a combination of products
April 2, 2018 at 10:46 pm #2912Soft79KeymasterI will see if I have a spare minute tomorrow. I’m not at my dev PC currently.
April 2, 2018 at 10:48 pm #2913NooneParticipantok thank you thank you thank you thank you
April 3, 2018 at 8:33 am #2914Soft79KeymasterTry pasting this in functions.php:
add_filter('woocommerce_coupon_is_valid', function ( $valid, $coupon, $wc_discounts = null ) { $wrap_coupon = WJECF_Wrap( $coupon ); if ( $valid && $wrap_coupon->get_code() == 'your_coupon_code' ) { $items = WJECF_WC()->get_discount_items( $wc_discounts ); $qty = 0; foreach( $items as $item_key => $item ) { if ( $item->product === false ) continue; $qty += $item->quantity; if ($qty > 1) throw new Exception( WC_Coupon::E_WC_COUPON_NOT_APPLICABLE ); // Max amount of items is 1 } } return $valid; }, 10, 3 );
Replace your_coupon_code with the actual coupon code.
Then the coupon will invalidate if amount of items in cart > 1April 3, 2018 at 6:44 pm #2916NooneParticipantThank you so much i feel like I got more than my monies worth!
5 Star customer service!!!!!!
-
AuthorPosts
- You must be logged in to reply to this topic.