How do I ask the app to remove a discount code programmatically?
By default you would use the method below in order to not only remove the discount code from the app's data and widgets, but also to remove the code that Shopify's Checkout has remembered in its internal data.
window.discountOnCartProApp.removeCode('SOME_CODE');
If you will be calling the "applyCode" method immediately after "removeCode", then you should skip the clearing of Shopify's Checkout discount (to prevent conflicts) and instead use the method below.
window.discountOnCartProApp.removeCodeWithoutCartDiscountReset('SOME_CODE');
window.discountOnCartProApp.removeCode('SOME_CODE');
If you will be calling the "applyCode" method immediately after "removeCode", then you should skip the clearing of Shopify's Checkout discount (to prevent conflicts) and instead use the method below.
window.discountOnCartProApp.removeCodeWithoutCartDiscountReset('SOME_CODE');
Updated on: 27/03/2024