Woocommerce cash on delivery

Conditional Cash on Delivery in WooCommerce
Author Bartosz Gajewski
Reading time:
4 minutes read

Cash on Delivery in WooCommerce is a one of its basic payment options. It works great with the flat rate, but if you are using table rate shipping plugins the flat rate might be simply not enough. In this article, I’ll show you how to use WooCommerce COD together with Flexible Shipping plugin.

Cash on Delivery (or simply COD) is a very useful payment method. It allows your clients to pay for a product when they receive it from the courier. The basic functionality of this feature is available in WooCommerce. You can get all the information about it in WooCommerce documentation. However, what if you want to offer COD payment for more advanced and non-WooCommerce-in-built shipping methods?

Table Rate Shipping and Cash on Delivery

If you are using table rate shipping plugins, like Flexible Shipping, the basic COD might be not enough. You may encounter some difficulties or compatibility problems with the shipping methods coming from the 3rd party plugins, especially if they use the shipping cost calculation rules for specific shipping classes. But guess what – our Flexible Shipping plugin is fully compatible with the WooCommerce COD since it uses the same default WooCommerce shipping mechanisms. You will learn from this guide how to set everything up in two different ways – using Flexible Shipping PRO combined with WooCommerce COD and I will show you even more powerful combination with Active Payments payment management plugin.

How to set Cash on Delivery in WooCommerce for specific products?

As I mentioned before there are two different ways how it can be achieved, however, both of them involve using the Flexible Shipping PRO plugin.

In case you haven’t heard about it yet, Flexible Shipping is a very popular table rate shipping plugin with more than 100,000 shops using it on a daily basis. In the PRO version, it allows to set the shipping rules based on shipping class, which will be crucial in this case.

Flexible Shipping PRO WooCommerce 89.00

The best and most powerful Table Rate Shipping plugin for WooCommerce. Discover its endless possibilities and create the shipping cost calculation rules based on weight, price and more!

Add to cart or View Details
100,000+ Active Installations
Last Updated: 2024-03-26
Works with WooCommerce 8.4 - 8.7.x

Since both scenarios require using the Flexible Shipping plugin let’s begin and …

Add Flexible Shipping method

First, add a new shipping method, that will be enabled only for certain products or product categories. It’s all based on the shipping class. To do that, go to WooCommerce → Settings → Shipping and then to your Shipping Zone. There click on Add new shipping method button.

WooCommerce add shipping method

Next, choose Flexible Shipping as a shipping method and click Add shipping method.

WooCommerce Add shipping method window

As you can see it’s enabled by default just after it’s created. Click on the new Flexible Shipping method’s title:

Added Flexible Shipping method

to reach its configuration screen:

Flexible Shipping method title

Enter its name by filling in the Method Title field. For the purposes of this guide I named it Fixed price for pizza. Next, scroll down in order to…

Add shipping rules for Woocommerce COD method

In the rules table at the bottom of the screen create a new rule using the Add rule button. Set:

  • When: Shipping Class
  • cart contains: Pizza
  • rule cost is: $10

Selecting the shipping class here is the most important action you need to take here since we want to target and display this shipping method only for products from the chosen shipping class.

WooCommerce shipping cost calculation rule

In my example, it’s $10 for shipping products from the Pizza shipping class.

If you want to use more advanced rules here or want learn more about them, please check our WooCommerce Shipping by Rules Flexible Shipping guide.

Once the Flexible Shipping method is configured and all the changes saved, we’ve reached the point where the road splits and we need to…

Select the payment option – WooCommerce COD

As I previously mentioned, Flexible Shipping is a table rate shipping plugin which methods use the same core mechanisms as WooCommerce defaults. In other words, they are fully compatible with WooCommerce COD, so you don’t need to be afraid they won’t be recognized or you’ll encounter any other issues. That’s why if you choose this scenario the only thing left now it to point the Flexible Shipping method you’ve created to be handled by WooCommerce COD payment method.

To do that go to WooCommerce → Settings → Payments. In the available payment methods table click on Cash on Delivery. On its configuration screen select the Flexible Shipping method you’ve created in the Enable for shipping methods field and save the changes:

COD settings: Enable for shipping methods

If, in turn, you decided to use the second scenario i.e. …

Cash on Delivery in WooCommerce using Active Payments plugin

which offers much more flexibility and gives you the possibility to include e.g. some additional fees, start with turning the Active Payments plugin on. Once it’s enabled go to WooCommerce Active Payments. You should see all your configured shipping methods and active payment options there:

WooCommerce Active Payments settings

Using the checkboxes select which payment options should be available for each shipping method. In my case, it’s Cash on Delivery and PayPal for Fixed price for pizza shipping method dedicated for products with Pizza shipping class and PayPal for Standard shipping (other products).

Payment methods assigned

Please note that you can also define the additional fees for each payment method in the Fees tab:

Active Payments additional fees

Having all set now, let’s see how it works live in my shop.

Cash on Delivery in Woocommerce for specific products – results

When the customer adds to the cart a product with Pizza shipping class he will see only the Fixed price for pizza Flexible Shipping method and both, the WooCommerce COD and PayPal payment methods will be available to choose:

Conditional Cash on Delivery in WooCommerce configured

However, if he puts a different product without Pizza shipping class into the cart the Standard shipping method appears and there is only PayPal payment gateway available to choose:

Standard shipping with only PayPal enabled

Order result - standard shipping


In this article, you learned a lot about conditional Cash on Delivery in WooCommerce. Also, I showed you how to set Cash on Delivery for specific products in WooCommerce. Now it’s all up to you. I hope it will be helpful. Good luck!

Notify of
Inline Feedbacks
View all comments
Jimmy Ekisa
Jimmy Ekisa
3 years ago

Thanks so much Bartosz for this helpful guide. In addition, how can I set a small shipping cost on the condition that a customer opts for COD? For example, I have a basic woocommerce site where am selling items. I want a situation where a customer can pay using VISA card or can decide to pay cash on delivery. However, if customer decides to pay cash on delivery, I want them to first instantly pay for a small shipping cost. How do I enable this, please? Thanks in advance.

Łukasz Spryszak
Łukasz Spryszak
Reply to  Jimmy Ekisa
3 years ago

Hi Jimmy, I believe in such case you will need to use some 3rd party plugin allowing to split the payment into two parts – the first one for the shipping and the second ‘COD part’. Unfortunately neither our Flexible Shipping nor Active Payments plugins have such feature in-built yet.

2 years ago

Hi great article. In the case that customer adds pizza (has cod option) and tshirt (no cod option) – both of them to the cart. How will it work? Will it still show cod option for both or not show for both? If i wish to split cod for pizza and other payment mode for tshirt on the same billing can that be achieved ? Please assist . TIA

Łukasz Spryszak
Łukasz Spryszak
Reply to  Janicd
2 years ago

Hi Janicd, the Active Payments plugin mentioned above allows to assign the payment option to the shipping methods, not directly to the specific products. It means that if you configure a shipping method which will be available to pick once the customers adds two different products with different shipping classes e.g. pizza and a t-shirt to the cart the same time, you’ll be also able to define which payment options he/she should be available to choose from. The same applies for the split-payment mode – if you grant your customers the possibility to split the shipping into separate packages and allow them to choose which shipping method each package should be delivered with, you’ll be also able to configure the payment option available for each of them.

Check out our case studies

Dream Home Story
Furniture shipping via WooCommerce – Dream Home’s Case Study

Learn how to configure custom shipping rules for furniture orders – from heavy and bulky to small and light.

4 minutes read
Octolize Case Study
Vitrek’s Story

Read Octolize Case Study about Vitrek – a provider of innovative global solutions for High Voltage Test and Measurement.

2 minutes read
Octolize Case Study
EnglishSpeakingMum’s Story

Read Octolize Case Study about EnglishSpeakingMum – Polish dedicated and involved parenting blogger.

2 minutes read