Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Remove Coupon After Automatically Applied?
- This topic has 9 replies, 3 voices, and was last updated 7 years, 3 months ago by Soft79.
-
AuthorPosts
-
December 8, 2016 at 11:18 pm #937titlemanParticipant
Is there a mod to the code that would allow users to remove the applied coupon/credit to their cart, similar to what they can when it is applied manually by clicking on the coupon (in Smart Coupons)?
I want to auto-apply the coupon but give users the option of changing their mind once they get to their cart. I understand they could just remove the product from their cart, but having the remove function there would be a plus, if it is possible.
Thank you for any help on this.
JeffDecember 8, 2016 at 11:45 pm #939Soft79KeymasterIf you’re familiar with PHP take a look at wjecf-autocoupon.php. This is the file that handles autocoupons.
You can get the “Remove” link back removing the filter woocommerce_cart_totals_coupon_label hooked by our plugin. If the user clicks remove you should somehow invalidate the coupon to prevent it from being automatically applied; for example you can have wjecf_coupon_can_be_applied return false by placing a marker in a cookie.
April 25, 2017 at 4:01 pm #1295Robert LessengerParticipantI need the same thing achieved; however, I’m pretty new to all this stuff. I know how to access the php, but I can’t make out your instructions. Can you be a more specific on what steps to take.
To reiterate, I just need to give people the option to remove a free gift if they want to.
THANKS!
April 25, 2017 at 4:03 pm #1296Robert LessengerParticipantOh, and I’m trying to remove a free gift that is automatically added to cart. I don’t see any options for removing it or changing its quantity to 0 or anything else at all.
April 25, 2017 at 7:56 pm #1298Soft79KeymasterHi Robert,
that is not possible without some custom PHP scripting. Can I ask you why a user would want to remove a free item from his cart?
April 25, 2017 at 10:59 pm #1304Robert LessengerParticipantWe’re affiliated with a religious organization and some people who may already have the book (or many copies of the same book) may not want to take one out of courtesy.
If it is too troublesome, that is ok. I was just wondering if there was some easy way to do it. Like putting in some code or something.
April 26, 2017 at 10:29 pm #1307Soft79KeymasterHmm, that makes sense. How about not making it an auto coupon, but placing a button on the cart page ‘I want a free book with my order’ that will apply the coupon?
Just create a button that links to http://www.example.com/cart/?apply_coupon=the_coupon_code
Would that be a decent solution?
April 26, 2017 at 11:53 pm #1312Robert LessengerParticipantGreat it worked!
I used the Booster for Woocommerce plugin w/ the “cart custom info module” enabled and applied this code to show up right under the cart total.
If your order is over $15 you qualify for a free book.
<span><u>Click here to claim your gift.</u></span>Probably an easier way to do it, but I’m new to all this. Thanks for your help!
April 27, 2017 at 1:45 pm #1316Soft79KeymasterGreat, thanks for the feedback.
June 1, 2017 at 11:01 am #1439Soft79KeymasterRobert,
with the new 2.5.2 release, it is possible to have an option free gift selection. It requires a template override.
1) Copy wp-content/plugins/woocommerce-auto-added-coupons-pro/templates/coupon-select-free-product.php to wp-content/themes/YOUR_CHILD_THEME/woocommerce/auto-added-coupons/coupon-select-free-product.php
2) Replace
$input_type = $allow_multiple_products ? 'number' : 'radio';
by$input_type = 'checkbox';
Now the radio-buttons will be replace by checkboxes, and it is also possible to checkout with no product selected.
-
AuthorPosts
- You must be logged in to reply to this topic.