WooCommerce Conditional Shipping and Payments
Need more control over your checkout payment gateways, shipping methods and shipping countries/states? Tired of snippet-hunting?
Our new WooCommerce Conditional Shipping and Payments extension allows you to create simple or advanced rules to conditionally restrict payment and shipping options.
Here’s what it can do for you, in a nutshell:
Exclude Shipping Methods
- Bind shipping method restrictions with certain products, product categories, or shipping classes.
- Create multiple add-on flat rates and make them available conditionally, depending on the shipping destination or package weight.
- Create product-level restrictions to comply with shipping carrier terms-of-service and customs import regulations associated with specific products.
Exclude Payment Gateways
- Restrict gateway options based on billing country availability, or minimum transaction limits.
- Create gateway restrictions based on products and shipping methods to comply with payment gateway terms-of-service.
Exclude Shipping Countries and States
Exclude shipping countries and states in your shop based on conditions such as cart value and cart contents, including products and quantities.
Create product-based shipping country restrictions to comply with customs import regulations, or to control product sales in specific markets.
…still hunting for snippets?
Can this be used instead of the Table Rate Shipping in Woocommerce?
Hey Nina,
TRS is made specifically for creating shipping Zones and conditional Rates in these zones. So the UI and admin workflow are more suitable for this task.
CSP allows you to use the additional Flat Rates feature which is available in WC core, to conditionally enable each Flat Rate according to your specified rules. So if you just want to create a few different Rates based on weight/destination, you can achieve the same result using CSP.
TRS will make your life much easier, though, if you want to create a lot of Zones/Rates.
Hi, looking to sell both large and small items – for small items want to enable a flat-rate delivery cost and the Local Pickup option. For the large items, want to only allow Local Pickup. If both small and large ordered, only option will still be Local Pickup. Can this plugin achieve all this?
Definitely possible. If you create a “Small Item” and “Large Item” shipping class, you can create restrictions for the Flat-Rate method based on the presence of these shipping classes when checking out, such as:
– Disable Flat-Rate if the “Large Item” class is present.
This should be enough to do what you describe.
Can I create product-based shipping country restrictions for a digital product? For example, although most digital products in our store may be sold worldwide, for certain products we have territorial restrictions. If we can set product-based shipping country restrictions for a digital product, what will the restriction be based upon: billing address, IP address?
Hey Phil,
The best approach in your case would be to create Payment Gateway restrictions for these products based on the billing address. There is no IP condition built into CSP (that’s a nice idea, by the way).
Any recommendations for getting more specific about shipping address restrictions, like city or zip codes?
Need if for an ecommerce client.
Hey Jonathan,
WooCommerce 2.6 will include the ability to define Shipping Zones, which will allow you to attach specific shipping method instances based on the destination Country/State/ZipCode. All WC core shipping methods will support Shipping Zones, while I would expect 3rd party shipping plugins to gradually add support for this feature. This is the main reason why a ZipCode condition hasn’t been made available in the CSP extension yet.
Hey Manos,
I would like to require a minimum purchase amount for Woo Subscriptions that is based on the subtotal of each recurring billing/shipping. This would allow a customer to purchase monthly items and bimonthly items in the same cart but they would each have to meet the minimum purchase amount (not the cart total meets the minimum). If the minimum is not met, I would like to prevent customers from getting to checkout and provide a notice that minimum is not met.
I am not sure that CSP is the tool for this. Do you have any thoughts on how this might be accomplished. Thank you.
Jon
Hey Jon,
CSP doesn’t take recurring cart totals / item totals into account. It’s a very neat idea to implement in a new condition, though. It’s definitely not a feature that can be added overnight, but I’ll definitely pin it on my list!
Hi, is it possible to do the following with this plugin?
I want to define different zones within a same country (for example, different zip codes, etc.) and then set minimum amount needed for each zone.
Zone 1 – minimum purchase amount $10
Zone 2 – minimum purchase amount $20
Hi Suyash,
Once you have defined your shipping zones using WC, then you can use CSP to conditionally hide/disable the shipping method instances associated with each Zone based on cart/order totals.
So, the short answer is yes.
Thanks!
Is it possible to do this?
Two shipping classes – Delicate & Non-Delicate
Two shipping methods – Canada Post & Purolator.
If Delicate is in shopping cart (along with Non-Delicate OR NOT), only Purolator shipping is offered.
If ONLY Non-Delicate in shopping cart, then ONLY Canada Post is offered
Hey Ian,
Yes – this sounds like a typical use case for CSP.
Hi Manos,
I have a client of mine who needs me to extend the conditions part of your plugin regarding the payments gateways.
Do you have any developer documentation available ?
Best regards.
Hey there,
Unfortunately no — frankly we haven’t had any requests to write developer docs for CSP. There is basically one filter you need:
woocommerce_csp_conditions
in/includes/class-wccsp-conditions.php
.Writing a custom condition is usually a matter of copy/pasting an existing one — just remember to populate the
supported_global_restrictions
andsupported_product_restrictions
properties correctly and pay attention to what’s being passed in the$args
parameter ofget_condition_resolution()
andcheck_condition()
.Thanks for your reply Manos.
That’s somewhat how I did it. The reason I asked for dev docs is because I had some difficulties extending the WC_CSP_Condition class from outside your plugin. I didn’t want to hardcode the inclusion of its file but that’s what I resorted to.