Remove Item in checkout

alanalan Member
Hi,

We have a special item that we want to be included in the checkout only if the order is over $20. We allow users to remove items in the checkout. Currently, customers can remove all the items in their cart, bringing the total price to below $20, and still check out with the special item.

Is there a snippet I can use to remove this item if the total price drops below $20? I see the FC.cart.removeItem method, but I'm not sure what the arguments are or how to call it after the remove item event.

Thanks,

Alan
Comments
  • fc_adamfc_adam FoxyCart Team
    @alan,

    Thanks for posting - you can achieve what you're after there with some javascript. Something like the code shown at the following page should get you what you're after: https://pastebin.com/raw/vC2BZ4ED

    To apply it to your store, you would paste it into the "footer" textarea of the "Add custom header and footer code to your templates" option. You will find that option on the "configuration" section of your store's FoxyCart administration.

    Within the snippet you'll also need to update the product_url variable to set your products parameters. Also within the product loop - you'll need to identify the promo product if it's currently in the cart. In the example code, it's getting it based on the products code matching "promo".

    With the code edited and included in your store's configuration, you should see the promo product being dynamically added and removed from the cart on both the cart and the checkout as the customer interacts with the cart.
Sign In or Register to comment.