By default, there is no discount input field on the cart page.
I attempted to add a custom input form with the action set to "/discount/YOUR_CODE". However, when I try to apply two different discount codes, the second code replaces the first one. Shopify allows for discount combinations, so this experience is not ideal.
2
Answers
After investigating, I found that we can achieve this by using the URL format "/checkout?discount=CODE1,CODE2,CODE3". Here are the steps with sample code:
And this is the result:
Note: My code currently only applies for discounts of products and collections; it does not apply for discounts of shipping yet. You can try to add more logic later.
To add a discount input field to your Shopify cart page and allow for discount combinations, you need to:
Add a Discount Code Input in the Cart Template
Go to your theme code (Online Store > Themes > Actions > Edit Code), and find the cart.liquid file under the Sections or Templates folder (depending on your theme). You can add the following code where you want the discount field to appear.
Enable Discount Combinations (Manual and Automatic)
By default, Shopify doesn’t allow stacking multiple discounts (manual or automatic). However, to enable this functionality, you would need an app like KartDiscount, which not only allows setting up a discount field on both the cart and product pages but also supports stacking multiple discounts.
KartDiscount helps you:
Add discount fields directly on your cart page and product pages.
Stack multiple manual and automatic discounts, ensuring your customers get the best offers.
You can configure these settings in the app and customize how you want to apply discounts.
Customize the User Experience
After setting up the discount functionality with your theme and KartDiscount, you may want to style the input field and button for a better user experience. You can do this by adding CSS to your theme files.
Disclosure: I work for KartDiscount, the app mentioned above.
Make sure to adjust the code based on your theme structure, and using an app like KartDiscount can streamline the process and allow for more advanced discount features, such as stacking discounts.