Forum Replies Created
-
AuthorPosts
-
August 9, 2022 at 8:39 pm in reply to: Coupon for one brand and a few categories not working correctly #19095andy3Participant
Sounds like I should reach out to the Brands Plugin developer?
August 9, 2022 at 7:42 pm in reply to: Coupon for one brand and a few categories not working correctly #19093andy3ParticipantI am putting the Brand that I want to restrict to in the Allowed Brands field – New Balance in this case. All of my brands pull through to select from. Here is a screenshot.
August 8, 2022 at 2:35 pm in reply to: Coupon for one brand and a few categories not working correctly #19089andy3ParticipantHello,
That’s what I thought – but it’s not working as expected. I’m using the WooCommerce Brands Pro with PW WooCommerce Brands Coupon Add-on. We have been able to do this in the past, but it’s not working correctly now.
The example is that I only want Kid’s Shoes from the Brand New Balance to have 10% auto applied. When I add another Kid’s categorized item from another brand, that brand receives the discount as well. That can’t happen due to my brand restrictions.September 10, 2021 at 6:05 pm in reply to: Coupon priority between typed code and Auto Coupon #18018andy3ParticipantI did finally figure it out – whoever setup the coupon on our team had a category that should have been excluded in the included section, which ended up excluding what we wanted it to apply to. The typed coupon now overrides the auto coupon. However, the description of the coupon no longer shows up in the cart like it does normally, but I’m willing to go with that for now.
Thank you,
Andy
andy3ParticipantThank you for your help as always, is this possible with customization in functions.php? My marketing team is asking again.
Thank you,
Andy
andy3ParticipantThank you! I was able to get it to work. I had to make sure there were 2 matching products in the cart for it to work as expected.
andy3ParticipantThank you,
So would the snippet look like this? Or do I need to plugin the coupon code and category in the “if” portion of the snippet? Do I need to change the 10 and 5 in the last line at all?
add_filter( ‘woocommerce_coupon_get_discount_amount’, function( $discount, $discounting_amount, $cart_item, $single, $coupon ) {
$COUPON_CODE = ‘louiseflash’; // replace with the coupon code
$DISCOUNTED_CATEGORY = 971 ; // replace with the category that is discountedif ( 0 == strcasecmp( $coupon->code, ;$COUPON_CODE ) ) {
$_product = $cart_item[‘data’];
if ( $_product->get_parent_id() ) {
$_product = wc_get_product( $_product->get_parent_id() );
}
$cat_ids = $_product->get_category_ids();
if ( ! in_array( $DISCOUNTED_CATEGORY, $cat_ids ) ) {
$discount = 0;
}
}
return $discount;
}, 10, 5 );andy3ParticipantOk update – when I upgraded the plugin somehow deactivated and I needed to reactiveate it. Crisis averted! Phew.
I’d still love help with the first question though.
THanks!
andy3ParticipantIn the alternative – we could create a 20% off coupon that could be used on one cart item, a 30% off coupon that could be used on one cart item, and a 40% off coupon to be used on the remaining items. However, I would like to use the 20% off on the most expensive item, the 30% on the next cheapest item, and the 40% off on the remaining items.
Any help would be appreciated!
Andy
andy3ParticipantThis worked perfectly for us thank you!
So now an add on question – so our sale moves from 20% off all items ending in $.90 to the following:
20% off most expensive item ending in $.90
30% off the 2nd most expensive item ending in $.90
40% off the 3rd+ items ending in $.90Is something like this possible with the priorities above?
Thank you for your help as always.
Andy
andy3ParticipantThanks for reaching out – I always appreciate your help. I haven’t been able to test it yet, but it’s on my list this week. I’ll definitely let you know!
andy3ParticipantGreat thank you! I needed to do >149.99 for the $20 coupon, but it works. I appreciate the help.
andy3ParticipantWould a Custom Field match help with this?
-
AuthorPosts