Reputation: 11
I am trying to set a filter that would calculate the cash-on-delivery payment when the customer selects a specific shipping zone (for out-of-town deliveries). I'm using the Table Rates
Plug-in.
I was looking at this code (https://github.com/woothemes/woocommerce/issues/1499) at the answer by maxrice, but I can't adapt it to suit my needs:
My zone_id
to exclude COD payment is table_rate-3
.
Upvotes: 1
Views: 2110
Reputation: 3899
As you can see looking at http://docs.woothemes.com/wc-apidocs/source-class-WC_Gateway_COD.html the native woocommerce COD class has no filters or actions you can hook into for your problem.
What you could do is disable the woocommerce native COD payment gateway and make your own. This link here provides a bit of a template for making your own payment gateway.
http://docs.woothemes.com/document/woocommerce-payment-gateway-plugin-base/
You could paste the woocommerce COD class in here (where it says // Go wild in here
on line 31) and make changes as necessary. I imagine you'll mostly need to make changes to the is_available()
function. You put that code down in either your themes functions.php file or better yet make your own plugin.
Upvotes: 1