Shopify-Buy Discount Code Error

New Member
3 1 0

I am currently using the js-shopify-buy SDK (via gatsby-plugin-shopify-buy [])

TLDR: when apply a discount code via shopify-buy, the checkout object reflects the discount code; however, the webUrl provided by the checkout object has a discount code error: "Unable to apply this discount code. Try again"


The issue is that when I apply a discount code to the checkout object, the checkout object via 

        .addDiscount(checkoutID, discountCode)


the checkout object returned has the discount code applied, and the price object in the checkout object reflects the discounted price;

Screen Shot 2021-05-15 at 10.42.52 AM.png

however, when I go to the `webUrl` provided by the checkout object, the shopify checkout page shows the error under the discount code input field:

Screen Shot 2021-05-15 at 11.11.36 AM.png


What's going on?  Is this functionality supported?  Am I doing something wrong?


1) When I type the discount code that I applied programmatically (DISCOUNT2021) on the shopify checkout page, the discount code is successfully applied (so I assume there is no error with the discount code)

2) When I add another product to my checkout AFTER programmatically applying the discount, the discount shows up on the shopify checkout page.

Replies 2 (2)
Shopify Staff
Shopify Staff
241 40 30

Hey @kcdave

Would you be able to provide us with X-Request-Id returned for of a recent API request you have sent following this process? Also, please feel free to provide a checkout token, URL, or any other steps used from the JS Buy SDK and Storefront API to generate a checkout.

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit or the Shopify Web Design and Development Blog

New Member
1 0 0

Is there any update on this? We are facing the exact same bug. But we notice that after we add a second item to the cart after adding the discount code. The discount is correctly applied in the checkout