Discussing APIs and development related to customers, discounts, and order management.
Hello,
I am developing a custom app for my Shopify store and need help with applying a free shipping voucher or setting the shipping costs to 0.
I have tried multiple approaches, including:
- Using the checkoutDiscountCodeApplyV2 mutation.
- Attempting to manipulate the shipping rate directly through the Storefront API.
- Trying to use Shopify Functions to modify shipping rates.
However, I have encountered various issues:
What approach should I take to achieve free shipping through a discount code or by setting the shipping cost to 0? Does anyone have code snippets or examples they can share?
Thanks a lot!
Hi Clemenssim,
Using the `checkoutDiscountCodeApplyV2` mutation would be a good technique - you should be able to grant the scopes you need via this url (see this doc😞
https://{shop}.myshopify.com/admin/oauth/authorize?client_id={client_id}&scope={unauthenticated_read_checkouts, unauthenticated_write_checkouts}&redirect_uri={redirect_uri}&state={nonce}&grant_options[]={access_mode}
Try it out and let me know!
Liam | Developer Advocate @ 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