Repository Forums Support WooCommerce Extended Coupon Features PRO Remove Coupon After Automatically Applied?

Topic Resolution: Resolved
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #937
    titleman
    Participant

    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.
    Jeff

    #939
    Soft79
    Keymaster

    If 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.

    #1295
    Robert Lessenger
    Participant

    I 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!

    #1296
    Robert Lessenger
    Participant

    Oh, 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.

    #1298
    Soft79
    Keymaster

    Hi 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?

    #1304
    Robert Lessenger
    Participant

    We’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.

    #1307
    Soft79
    Keymaster

    Hmm, 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?

    #1312
    Robert Lessenger
    Participant

    Great 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!

    #1316
    Soft79
    Keymaster

    Great, thanks for the feedback.

    #1439
    Soft79
    Keymaster

    Robert,

    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.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.