Hide a payment method by shipping method, cart contents, address
These conditions look at the cart, the address and the store clock: Shipping method name, Cart weight, Cart contents, City, Address type, Address lines, Day of the week, Date, Time of day, Currency, B2B buyer with company names, and Cart attribute. Shopify only lets one checkout function read a limited set of facts, so the app runs rules with these conditions in a second payment customization, named “Checkora: Hide Payment Methods (cart, address and schedule)”. The app creates it when you save the first such rule and deletes it when the last one is gone.
Before you start
- These conditions are part of every plan.
- A rule with one of these conditions can Hide payment methods or Show only these payment methods. It can’t rename or move payment methods.
- It can’t be combined with Product tag, Collection, Customer tag, Customer orders, Customer total spent, Open COD orders or Cancelled COD orders in the same rule. Put those in a separate rule. Cart subtotal, Item quantity, Product type, Vendor, SKU, Country, Region or province, Postcode, Delivery method, Customer login and B2B buyer without company names work in both.
- Shopify allows 25 active payment customizations per store, shared by all apps. If the store already has 25, saving shows an error. Turn off or delete one under Settings › Payments › Payment customizations, then save again.
Steps
- Open Rules and click Add rule. Enter a Name.
- Under Conditions, click Add condition and pick a Condition type:
- Shipping method name: the name of the shipping rate the buyer selected, for example
ExpressorDHL. Under Match, choose contains one of, is one of, contains none of or is none of. - Cart weight: a Minimum, a Maximum or both, in g, kg, lb or oz. Each item’s weight times its quantity; products without a weight count as 0.
- Cart contents: Any item is, Every item is or No item is a physical product, a digital product (no shipping), a gift card or a subscription.
- City: the whole city name the buyer entered, letter case ignored. Add each spelling buyers use.
- Address type: PO box, Parcel locker or post office pickup or No house number, read from address lines 1 and 2.
- Address lines: words or phrases anywhere in address lines 1 and 2, letter case and dots ignored.
- Day of the week, Date (from MM-DD to MM-DD, every year; 12-20 to 01-06 runs over New Year) and Time of day (is before or is at or after HH:MM). All in your store’s time zone, set in Shopify under Settings › General.
- Currency: three-letter codes of the currency the buyer pays in, for example
CHF. - B2B buyer: enter Company names (optional) to match only those companies, whole name, letter case ignored.
- Cart attribute: an Attribute name your theme or another app saves in the cart, such as
gift_wrap, and the Attribute values to compare. The name’s letter case counts; the values’ doesn’t.
- Shipping method name: the name of the shipping rate the buyer selected, for example
- Under Action, choose Hide payment methods or Show only these payment methods, and the payment methods by name.
- Turn on Switched on and click Save.
Limits across all your rules
- Time of day: all rules together can use two different times, for example 09:00 and 18:00.
- Cart attribute: all rules together can read one attribute name.
A third time or a second attribute name is refused when you save, with a message about Shopify’s limits.
Verify it worked
Open Simulator. Enter the shipping method name, the city and address lines under Delivery, item weights and kinds under Cart, the Date and time, and the checkout currency, company name and cart attribute. The payment method shows Hidden under Before your rules.
Troubleshooting
The payment method shows before the buyer chooses shipping or enters an address. Shipping method name, City, Address type and Address lines are not met until checkout knows them, whatever the Match. Nothing is hidden for an unknown value.
A cart attribute rule with “is none of” hides the method in every cart. An attribute the buyer has not set counts as an empty value: “is one of” is not met and “is none of” is met.
The rule works in the simulator but not at checkout. On Rules, the Payment methods card must show On. If it shows Needs update, click Update checkout. The second payment customization is switched on and off together with the first.