How to Hide Cash on Delivery (COD) for a Product Variant on Shopify
Video Turtorial
Follow these simple steps to hide the Cash on Delivery (COD) payment option for specific product variants during checkout.
Step 1: Open the Checkout Rules App
- Click on the Checkout Rules app from your admin dashboard.
Step 2: Access Payment Method Customization
- Once in the Checkout Rules app, click on the "Payment Method" section.
Step 3: Create a New Payment Rule
- Click on the "Create Payment Rules" button.
Step 4: Define the Rule Conditions
- In the new rule setup, you'll see two main sections: Condition and Action.
- In the Condition section:
- Select "Product variant Title" from the dropdown menu.
- In the Operator section, choose either "Match regex" or "Not Match regex". These options allow you to use regular expressions to specify your conditions.
- For example, if you want to hide COD for all "L" variant items, you can use the regular expression
\\bL\\b
.
Step 5: Set the Action to Hide COD
- In the Action section:
- Select "Hide payment method" from the dropdown menu.
- In the Payment Method Name field, type "Cash on delivery".
Step 6: Make Rule Active
- Change the status of the rule from draft to Active.
Step 7: Save the Rule
- Save the created rule.
- After saving the rule is Active you can test by going to your store checkout page.
Operators Supported
1. Equal or Not Equal
Checks if a value exactly matches (or does not match) a specified value.
Example:
- Equal: If the product variant title is exactly "Large", hide COD.
- Not Equal: If the product variant title is not "Small", hide COD.
2. Contains or Not Contains
Checks if a value contains (or does not contain) a specified substring.
Example:
- Contains: If the product variant title contains the word "Limited", hide COD.
- Not Contains: If the product variant title does not contain the word "Standard", hide COD.
3. Regex Match or Not Match Regex
Uses regular expressions to check for patterns within a value.
Example:
- Regex Match: If the product variant title matches the regex pattern
\\bL\\b
(indicating the presence of the standalone letter "L"), hide COD. - Not Match Regex: If the product variant title does not match the regex pattern
\\bXL\\b
, hide COD.
4. Empty
Checks if a value is empty (contains no data).
Example:
- Empty: If the product variant title is empty, hide COD.
5. Length is greater than
Checks if the length of a value is greater than a specified number.
Example:
- Length is greater than: If the length of the product variant title is greater than 10 characters, hide COD.
6. Length is less than
Checks if the length of a value is less than a specified number.
Example:
- Length is less than: If the length of the product variant title is less than 5 characters, hide COD.
And there you go! You've successfully set up a rule to hide the Cash on Delivery payment option for specific product variants. Now, when customers select those variants, COD will not be available as a payment method.
Feel free to customize and refine these steps further to fit your specific needs. If you have any questions or need more assistance, just let me know!