Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Here is a scenario, I have a custom storefront and a discount code that gives 100% discount on shipping rates when the shipping costs less than $10.
This works fine on Shopify native checkout see screenshot below.
Now, when using GraphQL to get the same checkout object to render my custom checkout experience I can't find a way to figure out how to apply the discount only to a certain shippingRates when rendering the screen, see GraphQL responses for checkout.discountApplications and discount.availableShippingRates
Any help would be awesome!
We're currently facing the same problem. We're creating a custom checkout using the storefront API, but we're facing some issues with visualising a discount being applied to a shipping rate.
With the script editor, you can create a discount for a specific shipping rate. When using the storefront API, there's no way to link a shipping discount created with the script editor to a shipping rate.
However discounts being applied to a line item are collected in a discountAllocations array for each line item. Isn't this possible to do this as well for the shipping rates?
Any updates about this? I'm facing the same problem and i'm getting a lot of trouble with my customers regarding this.
No word from Shopify 😞 I've never managed to fix the problem.
Still waiting more than a year later. Shipping is a shambles.
We want to charge a flat express shipping rate regardless of where items are being fulfilled from (we have 5 locations). Shopify pushed me to use an app, or write a script. So I wrote a script to apply a discount by dividing the flat rate by the rate that was going to be charged to the user, subtracting that value from 1, then multiplying the charged rate by that number to get the discounted value (e.g. if the flat rate is $20, and the user gets charged $60 for shipping, it applies a discount of $40 to get back to $20).
It only works at checkout, no sign of discounts in the cart, customers remain confused until they get to checkout. Really frustrating.
Because of the issues with missing data and other issues with the lack of support for custom store checkouts I had to move away from Shopify. It’s clearly not part of their business strategy and they have no plans to support that. So we moved to WooCommerce.
If you look at my other posts, they are all related to custom checkouts, and none of the issues I found were ever addressed.