Our business uses Shopify Plus to handle our product purchasing for our service. We've been using it for about 3 or 4 years now.
We implemented the Buy SDK a while back on our main site which allows the user to quickly purchase a product instead of going to the store subdomain. They're able to click on a 'buy button' and be prompted with a list of variants of the product, then they hit checkout and are immediately taken to checkout.
This was all great until we started wanting to use Shopify Scripts to give discounts to our users who are VIP members. When one of these users places an order through the actual Shopify hosted storefront, the Line Item scripts run and apply discounts just fine.
However, when the user uses the Buy Button SDK on our main site, Line Item Scripts do not run at all during checkout. This results in a mess of a situation for us where some users get the discounts when going directly through the store, and other users do not. This results in customers sending us support tickets asking for partial refunds for their discount.
Why do Line Item scripts not apply for checkouts generated via the Buy SDK? It seems very weird that they are limited only to a POST request from the Shopify hosted site to /cart on the Shopify hosted site.
Is there a reason why they cannot be applied at the initialization of any checkout? Is there plans to support them at all when creating a checkout via the buy sdk? Is there a solution at all to make sure they trigger while still keeping our current flow from Our Site -> Shopify Checkout?
Channels (like buy button, js buy, etc) only create checkouts. The online storefront creates carts and checkouts. It's a subtle point but not all checkout flows are the same behind the scenes.
If you must use Shopify Scripts you'd need to look into adjusting how the cart is created. This could be a process in which you
That process will give you a cart and checkout via the online storefront and Shopify Scripts will trigger.
Not without drawbacks for something to consider if you're running into enough customer service issues. Also be sure to push the feedback to your MSM.