How to Split Cart Items in the Same Order on WooCommerce (with Video)

Split cart items

Last updated - May 4, 2022

The shipping strategy on your online store is dependent on a lot of factors. Sometimes you will be selling a bunch of products that require completely different approaches to shipping. What if your customers order these products together? How will you manage multiple shipping methods in order? This scenario is also applicable for multi-vendor marketplaces where different vendors would want specific shipping methods to apply. In this article, we will discuss a few scenarios where you need to choose multiple shipping methods in one order. Also, we will see how you can split cart items in the same order and ship using different methods.

Different scenarios where you need to split cart

There are different scenarios where you want to split the cart in the same order and provide different shipping methods to customers. Here is a look at some of these:

When you have multiple warehouses

Sometimes you will be using multiple warehouses to store your products. How will you account for the shipping charges when a customer’s order includes products from multiple warehouses? The available shipping methods, rates and even the time of delivery will be different according to the warehouse you are sending it from. Here you can split the cart and offer multiple shipping methods to customers. Overall, it will help you display shipping options in a more transparent way.

Shipping heavy products along with regular ones

There can be cases where you are selling one or two products on your store that requires freight shipping. What if customers order these products along with some of the regular products? You can split the cart and show separate shipping methods. From a pure customer experience perspective, you can think of hiding other shipping methods, when a product with special shipping requirements is in the cart. However, for seamless fulfillment, sometimes you may want to keep the shipping options separate. So, splitting the cart in the same order can be useful for you in this case.

Free shipping only for a particular shipping class

Consider a scenario where you want to offer free shipping only to products belonging to a particular shipping class. Chances are high that customers will order some other products when they are ordering products from this shipping class. So how will you manage to deal with this situation. You can let the other shipping methods override the free shipping option. However, if you want to clearly communicate to customers that there is a free shipping option available with a particular shipping class, you can split the cart. This way, it will be clear to customers about which products they are charged shipping charges for.

Handle pick-up only products

Sometimes you maybe selling products that you don’t want to ship, but allows pick up from your location. You can provide an option to customers to buy such products along with other regular products. Moreover, you can let customers choose whether they need some products to be shipped, or can pick up all products locally.

WooCommerce Advanced Shipping Options

This plugin gives you the freedom to split a cart into multiple shipping packages. Each shipping package will have its own rates based on the configuration that you opt for. It offers conditional logic to help you set up different shipping packages exactly the way you want it. On the frontend, the customer will see available shipping options for each package and can choose accordingly.

Split Cart Items in the Same Order
This plugin help you Split cart Items in the same order, and apply shipping methods selectively.

You can use this plugin to split the shipping cart in different scenarios where products that require diverse shipping approaches are in the cart. The plugin also helps with your order fulfillment process as notifications are sent to customers as well as store managers detailing the selected shipping methods.

Features

Here is a look at some of the useful features of this plugin:

  • Create unlimited shipping packages based on cart details, product features or shipping location.
  • Sort the order of packages according to your store strategy.
  • Conditional logic to help you control shipping package creation dynamically.
  • Name individual shipping packages created in the cart
  • Rename default WooCommerce shipping option.
  • Selectively exclude shipping methods from a package.

The single site subscription of the plugin will cost you $49.

How to split cart using Advanced Shipping conditions plugin?

You can set up multiple shipping packages on your store by following the below steps:

1: Purchase the plugin. Install and activate it.

2: Enable the plugin from the settings page and add a shipping package.

Split Cart Items in the Same Order
Once you enable the plugin, you can create a new shipping package.

3. Determine the products included in the shipping package.

Split Cart Items in the Same Order
You can choose products based on different conditions.

4. Define the order of applying shipping packages when multiple shipping packages are created.

Split Cart Items in the Same Order
You can simply drag and drop to set the priority of application of shipping packages.

5. Customers will see split cart when they add products from multiple shipping packages.

Split Cart Items in the Same Order
The cart will show multiple packages as per the settings.

Please note: The products that do not belong in any shipping packages will be under the default ‘shipping’ option together.

Splitting cart in multi-vendor marketplaces

Another scenario where you see split cart in the same order is in stores that have multiple vendors. If you are running a store with multiple vendors, you may want to see how you can apply shipping methods selectively.

You need to use a multivendor plugin to set up products by multiple vendors. Most of these plugins allow vendors to handle their own shipping strategy. Based on the settings, the cart will be split to show multiple shipping options when customers choose products by different vendors in one order.

Displaying real time rates with split cart

As you know, you can use real time shipping rates by integrating a popular shipping carriers to your WooCommerce store. ELEX is one of the popular developers with several plugins that will help you integrate popular shipping carriers such as USPS, FedEx, UPS, etc. But, how will you split cart and offer the flexibility for each vendor to set their own applicable real time rates?

You can use the below code snippet to provide customers with an option to choose a different shipping option for each package. It will split cart items from the same order and ship via multiple shipping methods.

If you want to display a specific vendor’s name, then you can use the hook in template cart-shipping.php and then replace the vendor name instead of a random numbering method.

define("PV_ATTRIBUTE", "vendor");
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Check if WooCommerce is active
*/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
if ( ! class_exists( 'TH_Shipping_Options' ) ) {
class TH_Shipping_Options {
/**
* Constructor for your shipping class
*
* @access public
* @return void
*/
public function __construct() {
// take care of anything else that needs to be done immediately upon plugin instantiation, here in the constructor.
add_filter( 'woocommerce_cart_shipping_packages', array( &$this, 'th_woocommerce_cart_shipping_packages') );
// Overriding template to introduce vendor names along with standard labels across shipping packages.
//add_filter( 'woocommerce_locate_template', array( $this, 'th_woocommerce_locate_template' ), 10, 3 );
}
function th_woocommerce_locate_template( $template, $template_name, $template_path ) {
if('cart/cart-shipping.php' == $template_name)
{
$path = plugin_dir_path( __FILE__ ) . '/woocommerce/templates/' . $template_name;
return file_exists( $path ) ? $path : $template;
}
return $template;
}
function th_woocommerce_cart_shipping_packages( $packages ) {
// Reset the packages
$packages = array();
$vendor_items_map = array();
foreach ( WC()->cart->get_cart() as $item ) {
$product_id = $item['product_id'];
$vendors = get_product_vendors( $product_id );
if ( $item['data']->needs_shipping() ) {
if($vendors) {
foreach( $vendors as $vendor ) {
// Expecting/assuming there is only one Vendor assigned per product. Hm.
$vendor_items_map[$vendor->ID][] = $item;
break;
}
}
// No product vendor associated with item.
else {
$vendor_items_map['0'][] = $item;
}
}
}
foreach($vendor_items_map as $key => $vendor_items) {
$packages[] = array(
//'ship_via' => array( 'flat_rate' ),
'contents' => $vendor_items,
'contents_cost' => array_sum( wp_list_pluck( $vendor_items, 'line_total' ) ),
'applied_coupons' => WC()->cart->applied_coupons,
'destination' => array(
'country' => WC()->customer->get_shipping_country(),
'state' => WC()->customer->get_shipping_state(),
'postcode' => WC()->customer->get_shipping_postcode(),
'city' => WC()->customer->get_shipping_city(),
'address' => WC()->customer->get_shipping_address(),
'address_2' => WC()->customer->get_shipping_address_2()
)
);
}
return $packages;
}
}
// finally instantiate our plugin class and add it to the set of globals
$GLOBALS['th_shipping_options_init'] = new TH_Shipping_Options();
}
// Start up this plugin
add_action( 'init', 'TH_Shipping_Options' );
function TH_Shipping_Options() {
global $TH_Shipping_Options;
$TH_Shipping_Options = new TH_Shipping_Options();
}
}

Multi-vendor support for ELEX plugins

If you are using ELEX shipping plugins, you can use this add-on to help vendors access real time rates based on their location. Please note, you can use this add-on when you already have a multi-vendor plugin and one or more ELEX shipping plugins installed on your WooCommerce store. It is compatible to popular multi-vendor solutions such as Dokan, WooCommerce product vendors and WC Vendors.

Split Cart Items in the Same Order
The split cart will display shipping rates specific to a vendor when products of multiple vendors are in the cart.

Features

Here is a quick look at what all you can do with this plugin:

  • Help vendors display their own real time shipping rates with integrated carriers.
  • Option to provide a combined shipping costs on the checkout page by adding all shipping costs.
  • Compatible with popular multivendor solutions and ELEX shipping plugins.

This add-on will cost you $49 for a single site subscription. Please note, this add-on will work only when you have an ELEX plugin in a multi-vendor environment.

Splitting cart to multiple shipping addresses

Now, another scenario where the cart is split in the same order is when customers want to send products in an order to multiple addresses. This is a common concern during holiday season when customers want to send gifts to friends and family. So, if you are providing an option to send items in the same order to multiple locations, you may be enhancing customer experience significantly. Let’s see how you can manage this:

Shipping Multiple Addresses

This plugin will help your customers to send items from the same order to multiple shipping addresses instead of creating multiple orders. It also has an option for cart duplication where the same cart can be recreated and send to a different address. Moreover, the plugin provides you the flexibility to exclude certain products from the multiple address shipping option. You can customize the text to let your customers know about the possibility of shipping to multiple addresses in the checkout page.

Split Cart Items in the Same Order
This plugin helps you provide an option for your customers to send products to multiple address while checking out from the same order.

Features

Here are the prominent features of this plugin:

  • Provide an option for your customers to ship to multiple locations with a single checkout.
  • Duplicate carts to send to multiple locations.
  • Let customers save multiple addresses
  • No limits in the number of items or addresses in an order.
  • Exclude products or categories from multiple address shipping.
  • Option to send status emails for partially completed orders.
  • Supports all WooCommerce shipping methods.

Hope this article has given you an overview on different scenarios where you need to split cart items for the same order. The strategies and tools discussed in the article should help you with better store management as well as provide scope to enhance customer experience.

Check out the video below:

Further reading

2 COMMENTS

  1. Advanced Shipping Packages is a phenomenal plugin.

    Do you know of any plugins to split the cart into two separate orders?

    Use case: certain products require a custom shipping quote due to size and such products get placed into an order with custom order status pending-quote (Quotes for Woocommerce plugin) BUT other items in the cart can be checked out immediately and have a normal order created.

Leave a Reply to Joe Cancel reply

Please enter your comment!
Please enter your name here