Shopify / mobile-buy-sdk-ios

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.
MIT License
452 stars 199 forks source link

Cannot checkout if discount applied to inapplicable item #994

Closed mnshukla95 closed 5 years ago

mnshukla95 commented 5 years ago

When I apply a discount to an item that it is not applicable to and carry on with a full checkout, my checkout doesn't complete and I get back a generic error stating: "Your checkout was unable to be completed. Please try again"

I figured something was wrong with the discount application in the checkout object, and I noticed that if I clear the discount object after I get back that the discount code is not applicable that I can then checkout freely. However, a user should be able to checkout even if an invalid discount application remains in the checkout object.

rebeccajfriedman commented 5 years ago

However, a user should be able to checkout even if an invalid discount application remains in the checkout object.

A discount code can become inapplicable at any time (not just immediately after it was applied). Here are my concerns with your approach: 1) If a client is not properly surfacing that the discount code became inapplicable, there could be some confusion about the price when a customer makes a purchase. This could lead to poor trust between the customer and the merchant, or a refund request. 2) A client may want to get a checkout object with the inapplicable discount code on it so that they can surface custom and specific UI to the customer.

There is a checkoutDiscountCodeRemove mutation that you can use to remove the invalid discount code before proceeding with the checkout.

I'll leave this ticket open in case you have any other thoughts.