Shopify-Buy Discount Code Error

kcdave
New Member
3 1 0

I am currently using the js-shopify-buy SDK (via gatsby-plugin-shopify-buy [https://github.com/ginlane/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 

shopifyClient.checkout
        .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?

P.S:

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.

0 Likes
awwdam
Shopify Staff
Shopify Staff
58 4 2

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 Shopify.dev or the Shopify Web Design and Development Blog

0 Likes