Ability to remove discount code

After applying a discount code, it can't be remove, and the discount code stayed in the cookie(as told by Webflow support) even when customer back out of checkout page and go back in.

  • Cloud Tan
  • Jul 20 2023
  • Pattterns commented
    22 Jan 23:02

    I’ve struggled a lot with this issue, but I finally came up with a creative solution! The thing is, Webflow only allows one discount code in the cart at a time. So, if you apply a new discount code, it replaces the old one. That got me thinking—what if the new discount code has a 0% discount? Problem solved! 🎉

    Here’s how you can do it:

    1. First, create a discount code in your Webflow Ecommerce settings called "NODISCOUNT" and set it to a 0% discount.

    2. Then, add this script to your site to automatically apply it:

      <script>

    3. document.addEventListener("DOMContentLoaded", () => {

    4. // Checkout elements

    5. const discountInput = document.getElementById("wf-ecom-discounts");

    6. const applyButton = document.querySelector("[data-ecom-discount-submit]"); // Adjust selector if necessary


    7. // Set the "NODISCOUNT" code

    8. const noDiscountCode = "NODISCOUNT";


    9. // Automatically apply the "NODISCOUNT" code

    10. if (discountInput && applyButton) {

    11. discountInput.value = noDiscountCode;

    12. applyButton.click();

    13. }

    14. });

    15. </script>


  • Taryn McKay commented
    January 19, 2024 10:01

    Same issue. Even after I have set the code to expire, deactivated and deleted the discount code it stays applied in checkout until I remove all the products.