[vc_cta h2=”The Below Code Works for the Following Plugins:”]
- WooCommerce UPS Shipping plugin
- ELEX WooCommerce DHL Express / Paket Shipping plugin
- WooCommerce FedEx Shipping plugin
- ELEX WooCommerce USPS Shipping plugin
- WooCommerce Canada Post Shipping plugin
- ELEX WooCommerce Stamps.com USPS Shipping plugin
- ELEX WooCommerce Australia Post Shipping plugin
- WooCommerce Multi-Carrier Shipping plugin
- WooCommerce Table Rate Shipping Pro plugin
- ELEX EasyPost (UPS, USPS & FedEx) Shipping plugin
[/vc_cta]
The below code snippet will help you tor –> functions.php file.
In the above snippet, we can see there are three groups made.
– Group 1 has shipping class “class-a”.
– Group 2 has shipping class “class-b”.
So, if there are products of shipping class “class-a” and “class-b” in the cart, then the cart will split into two package components.
Package 1 will have product of shipping class “class-a”.
Package 2 will have product of shipping “class-b”.
This can be seen from the screenshot below :
Before snippet :
After Snippet:
In this case, there were 3 groups initially, hence showing 3 carts.
Note : Allowing multiple shipping the package for one order was introduced by WooCommerce version 2.1. So this snippet will be applicable for versions higher than 2.1.
hello it does split cart items but does not display shipping cost associated class .it only displays flat rates but cost is not calculated.
Hi Irvanjani,
Split cart will work only when the products in the cart are assigned with separate shipping classes.
Can you kindly confirm whether your products have separate shipping classes assigned?
Let us know if you have any query.
Regards,
doesn’t work for 3.x. Can we get updated code?
Hello Andrew,
Thank you for reaching us. The above snippet works for 3 groups of classes (Class IDs) as you can see the outcome is shown in the screen shot. Please raise a request on https://support.xadapter.com/hc/en-us with your complete query. We will definitely help you in fixing it.
Thanks and regards,
Veeresh.
Team XA
after adding this code to the themes function.php file right below it still stays the same can you guide me on where i am going wrong.