Split cart items based on shipping class(Allow multiple shipping packages for one order based on shipping class)
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 :
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.