I could use Storefront API.
Can you please give me an example of how to achieve this?
Goal: hide a specific shipping method when a particular discount code is applied at checkout.
API constraints: Storefront API doesn’t expose a shipping method object; only the Admin API has it, so you can’t directly control shipping methods via Storefront API during checkout.
Shopify Plus option: Use Script Editor (Shipping Scripts) to detect the coupon code and disable the gateway. This is a native checkout customization available only on Plus.
Non‑Plus workaround: Use a third‑party app (e.g., ShipRight – Conditional Shipping Methods) and approximate by matching the “Discount amount” condition to hide the chosen shipping method. Caveat: this may also affect other coupons that share the same discount value. An image is included to illustrate the app setup.
Context notes: All Shopify plans support discount codes; the question is about tying codes to shipping visibility.
Status: No built‑in Storefront API solution. Practical paths are Shopify Plus Scripts or an app-based conditional rule. The thread does not confirm a final implementation by the asker.
I could use Storefront API.
Can you please give me an example of how to achieve this?