Shopify Hide Payment Method with a Payment Customization Function (2027)
Shopify hide payment method with your own Payment Customization Function: hide Cash on Delivery on orders over $500 or for Canada, rename Bank Deposit and move it to the top. Episode 7 of the Shopify Functions 2027 serie
Shopify hide payment method with your own Payment Customization Function: hide Cash on Delivery on orders over $500 or for Canada, rename Bank Deposit and move it to the top. Episode 7 of the Shopify Functions 2027 series (API 2027-01). Real checkout on our dev store: with the customization off a US buyer sees Credit card, Cash on Delivery (COD) and Bank Deposit. With it on, "Bank transfer (within 3 days)" comes first; a $595 cart and a Canadian address get no Cash on Delivery.
3 quick fixes from this episode
Shopify Cash on Delivery: Hide COD on Orders Over $500
Shopify cash on delivery with a limit: a Payment Customization Function hides COD when the cart total is over $500. Real checkout on our dev store: $119 shows Cash on Delivery, $595 doesn't. API 2027-01.
Full episode: {TUTORIAL_URL}
Shopify #ShopifyFunctions #ShopifyDeveloper
▶ 60-second video: https://youtube.com/shorts/4tDy9ahTGBQ
Shopify Payment Method Customization: Rename and Reorder at Checkout
Shopify payment method customization with a Function: "Bank Deposit" becomes "Bank transfer (within 3 days)" and moves to the top of checkout. The rule lives in the customization's metafield, so you change it without a redeploy. Wallets like Shop Pay can't be renamed or reordered.
Full episode: {TUTORIAL_URL}
Shopify #ShopifyFunctions #ShopifyDeveloper
▶ 60-second video: https://youtube.com/shorts/vmBGEdckaC8
Shopify Payment Customization API: What Your Function Really Sees
Shopify payment customization API gotchas from a real store: 'Access denied for paymentCustomizations' until the app has write_payment_customizations, checkout's 'Credit card' arrives as '(for testing) Bogus Gateway' next to 'Deferred' and 'Gift card' entries, and payment method IDs you must read every run.
Full episode: {TUTORIAL_URL}
Shopify #ShopifyFunctions #ShopifyDeveloper
▶ 60-second video: https://youtube.com/shorts/9GSJSyE_LGs
Step by step
$119 vs $595: same buyer, different payment options (0:00)
Same buyer, same jacket. At $119, Cash on Delivery is there. At $595, it's gone.
One Shopify Function decides that. This is episode seven of Shopify Functions 2027: how to hide a payment method, with a Payment Customization Function. We hide Cash on Delivery when the cart is over $500.
We hide it for one country, Canada. We rename Bank Deposit and move it to the top. And I show you the real logs, a real error, and what only Shopify Plus can do.
Before: the customization is off (0:35)
First, the store without our Function. I switched the customization off. One bomber jacket, $119, a New York address.
Checkout offers three payment methods: Credit card, which is the test gateway on this development store, Cash on Delivery, and Bank Deposit, in that order.
Where the payment methods come from (0:57)
Cash on Delivery and Bank Deposit are manual payment methods, set up in Settings, Payments. A payment customization never adds a method. It only works on the methods checkout already has.
Our Function shows up one link further down, under Payment method customizations: Payment rules, episode seven, active, by our app.
What a payment customization can do (1:21)
A payment customization Function runs in checkout, including B2B checkouts. Shopify's docs list the cart, the Storefront API and Point of Sale as not supported. It returns a list of operations.
Hide removes a method from checkout. Rename changes the name the buyer sees. Move changes its position in the list.
Two more operations, payment terms set and order review add, are for Shopify Plus stores only, and order review is for B2B. Hiding a method in only one placement, like the express buttons, is also Plus only. On other plans, the whole method is hidden.
And a store can activate up to twenty-five payment customizations.
How checkout calls the Function (2:04)
Here is the flow. The buyer changes the cart or the address. Checkout collects the payment methods the store offers.
Then it calls our Function with that list, and our Function answers with operations. The buyer only ever sees the final list. And it runs more than once.
In my 119 dollar checkout, the logs show eight runs: three before the address was known, and five with it. So the Function must give the right answer from whatever it gets.
Generate the Function (API 2027-01) (2:34)
shopify app generate extension, template payment customization, flavor vanilla JS. The template writes 2026, oh seven, so we pin 2027, oh one, then run function schema and typegen. The handle is payment rules.
We need it later, to switch the customization on. One target: cart, payment methods, transform, run. That is the whole config file: one target, one export.
The input query (3:02)
The input query. From the cart, we need the total the buyer pays, and the country of each delivery address. The presentment currency rate converts our threshold from the shop's currency into the buyer's.
Then the payment methods: an ID and a name. Every operation points at that ID. And a metafield on the customization itself.
That is where our rules live. Five fields in total, nothing more.
Rules in a JSON metafield (3:30)
Here are the rules, stored as JSON on the customization. Hide Cash on Delivery when the total is over $500, or when the buyer is in Canada. Rename Bank Deposit to Bank transfer, within three days.
And move it to the top of the list. Because the rules are data, a merchant or your admin page can change them without deploying the Function again.
Hide Cash on Delivery over a total or for a country (3:54)
Rule one. Read the rules, the cart total, and the currency rate. Collect the countries of the delivery addresses.
Early runs have no address yet, so the list can be empty. A rule fires when the total is over the limit, converted with the rate, or when a delivery country is on the list. Our buyer pays in US dollars, the shop's own currency, so the rate is one.
Then every method whose name contains Cash on Delivery gets a hide operation with its ID. We also remember the ID, so the other rules skip it. With no address yet, the country rule simply can't fire.
You will see that at checkout.
Rename + move a payment method first (4:34)
Rule two. Find Bank Deposit and rename it. One limit from the docs: methods shown as a logo, like Shop Pay, Apple Pay, Google Pay and other wallets, can't be renamed.
Manual methods like ours can. Rule three. Move Bank Deposit to index zero, the top of the list.
Wallets can be hidden, but not reordered. And inside Shop Pay, the docs say payment customizations don't apply, except to the gift card field.
Switch it on: scope + paymentCustomizationCreate (5:04)
To switch it on, the app needs the write payment customizations scope. My first query, before I added it, failed with a real access denied error: the app was not allowed to see payment customizations. Add the scope to the app's config file, restart app dev, and the dev store grants it.
Then payment customization create, with the function handle, a title, enabled true, and the rules JSON in the same call. Use the function handle. It stays the same in every environment.
Real checkout: US $119, US $595, Canada (5:36)
Now the real store, with the customization on. One jacket, $119. Same New York address as before.
Three methods. Bank Deposit is now Bank transfer, within three days, and it's first, so checkout selects it. Credit card is second.
Cash on Delivery is still there, because the total is under five hundred. Now five jackets: $595. Same buyer, same address.
Only two methods are left: Bank transfer and Credit card. Cash on Delivery is gone. Exactly our rule.
Back to one jacket, $119, and this time a buyer in Canada. I pick Canada. While the address is not complete, Cash on Delivery is still listed.
The Function has no country yet. With a full Toronto address, checkout runs the Function again, and Cash on Delivery is gone, at $119.
What the Function really sees (6:38)
This is the real input from the Canada run, from the app dev logs. Checkout showed three methods. The Function received five.
There's an entry called Deferred, and one called Gift card. And the method checkout calls Credit card arrives as, for testing, Bogus Gateway. So match the names your Function really receives, not the labels on the checkout page.
The logs show them. The IDs are just positions: two, three. Read them from the input on every run, never hard-code them.
The output: hide number two, rename and move number three. The biggest run used about 550,000 instructions, out of the eleven million a Function may use.
Real runs become tests (7:19)
Four real runs went into the repo as test fixtures: no address yet, $119, 590 five, and Canada. On every push, GitHub Actions builds the Function, runs it with the 595 dollar input, and checks that all four fixtures still give exactly the same operations. All four passed.
So if you change a rule later and break the Canada case, the test fails before any buyer sees it.
Gotchas: Shop Pay, store credit, addresses, Plus only (7:47)
Gotcha one. The docs say payment customizations don't apply inside Shop Pay, except to the gift card field. So don't expect your rule there.
Gotcha two. Store credit and Shop Cash share one payment methods entry, so hiding it hides both. Gotcha three: early runs have no address.
Country rules wait for it, as we saw in Canada. Gotcha four: when plan or country restrictions apply, the input still lists all methods, but operations on restricted ones don't take effect. And five.
Hiding a method only in the express buttons needs Shopify Plus. On other plans, the whole method is hidden.
Recap (8:30)
Let's recap. A payment customization Function runs in checkout, on the methods that already exist. It hides, renames and moves them, by the ID in the input.
Our rules live in the customization's own metafield, so they change without a redeploy. To switch it on: the write payment customizations scope, then payment customization create, with the function handle. And match the names your Function really sees.
The code is on GitHub, tag E P zero seven, link in the description. Next episode: cart and checkout validation, blocking a bad cart with a clear error. See you there.
📖 The full written tutorial with every episode: https://www.wixob.com/shopify-hide-payment-method/
📚 Course page: https://www.wixob.com/shopify-app-development-2026/
🔔 New episodes on YouTube: https://www.youtube.com/@fayyaz-ahmed-shopify-developer?sub_confirmation=1
Questions about the Shopify GraphQL Admin API? Ask in the comments — I answer every one.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.