How to add a shipping method based on the specific payment gateway in WooCommerce
In WooCommerce, you may want to show or hide certain shipping methods depending on which payment gateway the customer chooses at checkout. For example, allow Cash on Delivery (COD) only with Local Pickup, or enable Express Shipping only for PayPal.
With the Flat Rate Shipping Plugin, you can create conditional shipping rules linked directly to payment gateways.
In The Article
Why use payment-gateway-based shipping methods?
- Control checkout flow: prevent mismatched payment and shipping methods.
- Reduce risk: limit COD to local deliveries only.
- Improve trust: provide reliable options that match payment types.
- Flexibility: Customize checkout experience for different customer preferences.
Configuration steps
1. Add a shipping method
- Go to Dashboard → Dotstore → Flat Rate Shipping.
- Click Add New Shipping Method
- Add the shipping cost (e.g., $10 for Express with Direct bank transfer).
- Or set shipping to Free when using a specific gateway.
2. Add a conditional rule
- In the shipping method settings, go to Shipping Rules.
- Click Add New Rule.
- From the Condition dropdown, select Payment Gateway.
Choose the payment gateway you want (e.g., Direct bank transfer, Cash on Delivery, PayPal, Stripe).
3. Save and test
- Click Save Changes.
At checkout, try switching payment gateways to confirm that the right shipping method appears.
Two real examples
Example 1: COD only with Local Pickup
- Rule: If payment gateway = Cash on Delivery, enable only Local Pickup shipping.
- Customer scenario: Customer selects COD → sees Local Pickup only.
Example 2: Discounted Express Shipping with PayPal
- Rule: If payment gateway = PayPal, enable Express Shipping with a $5 discount.
- Customer scenario: Customer pays with PayPal → Express Shipping shows at $10 instead of $15.