A space to discuss online store customization, theme development, and Liquid templating.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hey, im using this func:
await fetch(`/discount/${discountCode}`, { method: 'GET', headers: { 'Content-Type': 'application/json', }, });
to add discount code to the cart of the customers, but later on i have another place in the store that i need to add another discount code, but when i apply this function again but with another code, only the last one stays, and the first one is removed.
both of the discount codes are set to combine with anything, and when i try to enter them manually at the checkout page they do stay together,
Hey Harelk1015,
Heddy from Gameball: Loyalty Program & VIP here!
The issue you're encountering stems from Shopify’s API processing only one discount code at a time when using automated functions, even if the discounts are combinable. When you manually enter them at checkout, they can be stacked, but via API, it overrides the first code with the second. Unfortunately, there's no direct solution for applying multiple discount codes this way. You might consider guiding users to enter the codes manually at checkout or combining discounts through Shopify Scripts if you’re on Shopify Plus.