How to test checkout payment rules with draft orders
The quickest way to test a payment rule is a draft order. Build a draft order with the cart, customer and shipping address that should trigger the rule, click Share > Copy link, open the link in a private browser window and go to the payment step. Payment customizations run on that checkout link. They don't run when you collect payment for the draft order inside the Shopify admin, so what you see on the admin's payment screen tells you nothing about your rules.
Where do payment rules run?
Shopify's documentation for payment customization Functions lists where they run. The parts that matter for testing:
| Where | Do payment rules run? |
|---|---|
| Online store checkout | Yes |
| Checkout link from a draft order | Yes |
| Collecting payment for a draft order in the admin | No |
| Shopify admin, POS, order editing | No |
So a test only counts when you look at a real checkout page, as a shopper would.
Why test with a draft order?
A draft order lets you set up the exact situation a rule is about:
- You choose the products, so you can build a cart just above or just below any amount.
- You choose the customer, including one with a tag or with no previous orders, without signing in as them.
- You set the shipping address, so you can test an emirate or a city.
- Nothing becomes a real order unless you complete the checkout.
How do you set up the test?
- From your Shopify admin, go to Orders > Drafts and click Create order.
- Add the products for your test.
- In the Customer section, click Search or create a customer. Pick your test customer, or click Create a new customer, enter the details and click Save customer. Use a name you will recognise later, such as "COD Test", and a shipping address in the place you want to test.
- Click Save.
- Click Share, then Copy link. (You can also click Send invoice, which emails the checkout link. Send it only to an address you control.)
- Open the link in a private or incognito window, so nothing saved in your normal browser affects the test.
- Go through checkout to the payment step. Check whether COD is there, what it's called, and that your card and wallet options still show.
Don't mark the draft order as paid while you test. Shopify warns that once a draft is marked as paid, the link in its invoice won't work.
After each change (a tag, a product, the address), save the draft and open the link again in a new private window.
What should you check for each rule?
| Rule | Set up the draft order with | Expected result |
|---|---|---|
| Customer tag | A customer tagged cod-refused | COD hidden |
| Cart total | A total above your limit, then below it | Hidden above, shown below |
| First order | A new customer and a total above your first-order amount | COD hidden |
| Product tag | A product tagged no-cod | COD hidden |
| Region or city | A shipping address in a blocked emirate or city | COD hidden |
| Rename | A cart that breaks no rule | COD shown with your new name |
Test one rule at a time and keep everything else below its limit. A new test customer with a large cart, for example, can trip the first-order rule and the cart rule at once, and then you can't tell which one hid COD.
How do you test the Arabic name?
A payment rule can see the checkout language, which is how it shows an Arabic name to Arabic shoppers. Shopify shows the checkout in the customer's language once that language is published, so the simplest Arabic test is a normal checkout started from the Arabic version of your store:
- Check that Arabic is published in Settings > Languages.
- Open your store's Arabic address. Publishing a language adds a language code to your store's
URLs, so the address looks something like
example.com/ar(the exact form depends on how your markets and domains are set up). - Add a product to the cart and go to checkout.
- At the payment step, check the Arabic COD name, for example «الدفع عند الاستلام».
- Repeat from the English version of the store to check the English name.
If the test also needs a known customer, for example for a tag rule, sign in with a test customer account before you check out. For setting up Arabic in the first place, see how to offer an Arabic checkout on Shopify.
Why does my test look wrong?
Check these first:
- You checked inside the admin. Accepting payment for a draft order in the admin doesn't run payment rules. Use the checkout link.
- The draft has no customer, or the wrong one. The tag rule needs the customer attached to the draft. Without a customer, the checkout counts as a guest, and the first-order rule treats a guest as a first order.
- A different rule hid COD. Compare the cart total, the customer's order count and the address with every rule you have switched on.
- The draft was marked as paid. Shopify says its invoice link won't work after that.
- You reused an old tab. Open the link again in a fresh private window after each change.
- Your COD method has an unusual name. A rule that looks for "Cash on Delivery" may not recognise a method you called something else. Khaleeji COD recognises common English and Arabic COD names. If yours is different, rename the method or email 9090mohammad123@gmail.com.
What should you do after testing?
Delete your test draft orders, or leave them: Shopify deletes draft orders created on or after April 1, 2025 after one year without activity.
Try to stop at the payment step rather than placing the order. If you do complete a test checkout with COD and then cancel it, the order can show up as a cancelled COD order in your reports and refuser lists, so use a test customer you can recognise and leave out. For the rules you are testing, see how to block COD for specific customers and how to limit COD by emirate, region or city.
Sources
- Shopify.dev: Payment customization Function API
- Shopify Help Center: Creating draft orders
- Shopify Help Center: Sending invoices for draft orders
- Shopify Help Center: Draft orders and invoices
- Shopify Help Center: Localization and translation
- Shopify Help Center: Managing your store's languages
Checked on the date above. Shopify and courier settings change, so check the source if something looks different.