How to hide Cash on Delivery for specific pin codes on Shopify
Shopify's own payment settings let you turn Cash on Delivery on or off, but they don't let you limit it to certain pin codes. To do that you need a payment customization, a small Shopify Function that runs inside checkout and hides COD when the delivery pin code matches your list. In CashShield it's one rule: Postal code is in list your pin codes, action Hide COD.
Before you start: decide which pin codes
Start from your own delivery data, not guesses. Most couriers and shipping aggregators let you export orders with their final status. Group the COD orders by pin code and look at how many came back (RTO) in each. The areas with both enough orders and a high return rate are your first candidates.
Two ways to set it up, depending on how your returns are spread:
- Blocklist: hide COD only in the pin codes that cause trouble. Use this when most areas deliver fine.
- Allowlist: offer COD only in the pin codes you trust, and hide it everywhere else. Use this when COD only works in a few cities you serve well.
Step by step with CashShield
- Install CashShield from the Shopify App Store and pick a plan on Shopify's plan page. The 7-day trial starts there.
- In CashShield, open Rules and choose Create rule (or start from the template Block COD for restricted pin codes).
- Set the action to Hide COD.
- Add a condition: field Postal code, operator is in list for a blocklist (or is not in list for an allowlist). Paste your pin codes or upload a CSV. CashShield removes spaces and hyphens before matching.
- To cover a whole region without listing every code, use starts with instead:
11matches every Delhi pin code and400matches Mumbai. - Save, keep the rule enabled, and try a sample order in Checkout preview to confirm COD disappears for those pin codes.
How pin code prefixes work in India
An Indian PIN code has six digits. The first digit is the zone, the first two identify the postal circle or sub-region, and the first three the sorting district. That makes prefixes a compact way to target an area: a single starts with 11 condition covers Delhi, where listing every code would take dozens of entries. Prefixes also work for postal codes in other countries, since CashShield compares the code as text.
Limits worth knowing
- About 1,000 pin codes in total. Shopify gives a checkout function at most 10 KB of settings, and CashShield refuses to save rules that wouldn't fit rather than letting them silently stop working.
- Hiding COD is all-or-nothing for that checkout. Shopify's payment customization can hide, rename, or reorder a payment method, but it can't add a COD fee or change the order total.
- Don't over-block. Some shoppers will only buy with COD. Start with your worst areas, then watch orders and conversion for a couple of weeks before widening the list.
Questions merchants ask
- Can I hide COD for a pin code without an app?
- Not with Shopify's standard payment settings, which don't filter payment methods by pin code. You need a payment customization: a Shopify Function, which you add with an app such as CashShield or build as a custom app.
- Can shoppers in a blocked pin code still order?
- Yes. Only Cash on Delivery is hidden for them; your other payment methods, such as UPI, cards, or wallets, still appear. If COD is your only payment method, hiding it leaves those shoppers no way to pay, so keep a prepaid option on.
- How many pin codes can CashShield handle?
- About 1,000 in total across all rules. Shopify passes at most 10 KB of rule settings to a checkout function, so cover large areas with a 'starts with' prefix instead of listing every pin code.
Install from the Shopify App Store