Hiding payment method based on selected shipping method

Topic summary

Goal: Hide specific payment methods at checkout based on the selected shipping method in Shopify.

Key facts and constraints:

  • Payment Scripts (Script Editor) do NOT have access to the selected shipping method; there’s no direct message-passing between line item, shipping, and payment scripts.
  • Shopify Plus is required to edit checkout.liquid. Using Liquid + JavaScript in checkout.liquid to detect the chosen shipping option and hide/show payment methods in the UI is the common workaround. One user confirmed this works; a sample JS snippet targeting DOM elements was shared.
  • Attempting to use Script (Ruby) syntax like Input/Output objects inside checkout.liquid is incorrect.

Alternatives and recommendations:

  • Prefer modern Shopify Functions API to control payment methods, or use an app (e.g., PayRules) to conditionally hide payment methods without custom scripting.
  • If this is a recurring business need, raise it with your Merchant Success Manager (MSM). Advanced workarounds (e.g., customer tags, discount signals) still typically require checkout.liquid changes.

Other notes:

  • Requests for step-by-step guidance remain unanswered. A query about redirecting to Razorpay vs. COD wasn’t directly resolved beyond the JS hide/show approach.

Status: No native support in Payment Scripts; viable paths are checkout.liquid + JS, Functions, or third‑party app; discussion remains open.

Summarized with AI on December 28. AI used: gpt-5.

@fullyfilmy a customers chosen shipping_rates ,or cart attributes are accessible in payment scripts so you would need to use javascript in checkout.liquid to hide/show payment methods

https://shopify.dev/docs/themes/liquid/reference/objects/checkout#checkout-shipping_method

https://shopify.dev/tutorials/develop-theme-layouts-best-practices