Managing variable products in WooCommerce can be complex, especially when you need to split them into individual simple products. This process can be essential for better inventory management, clearer product listings, or tailored marketing strategies. In this guide, we’ll show you how to split variable products into simple products programmatically without using a plugin. This approach helps maintain control over your site’s functionality and performance.
Why Split Variable Products?
Splitting variable products into simple products can offer several benefits:
- Better Inventory Management: Each product variation is treated as a separate item, simplifying stock tracking.
- Enhanced Product Listings: Customers can see each variation as a distinct product, improving visibility.
- Targeted Marketing: Allows for individual promotion of each variation, catering to specific customer preferences.
Step 1: Backup Your Site
Before making any changes, ensure you have a complete backup of your website. This step is crucial to prevent data loss in case something goes wrong.
Step 2: Access Your Theme’s Functions File
To implement the changes, you need to add custom code to your theme’s functions.php file. If you don’t have a child theme, create one using our free child theme generator.
Step 3: Write the Custom Function
Add the following code to your functions.php file. This code will split the variable product into simple products:
/*
* Snippet: How to Split Variable Products Into Simple Products Without a Plugin in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1381
* Tested with WooCommerce 10.7.0
* "Function to split variable products into simple products"
*/
function wcsuccess_split_variable_product_into_simples($variable_product_id) {
$product = wc_get_product($variable_product_id);
if ($product->is_type('variable')) {
$variations = $product->get_children();
foreach ($variations as $variation_id) {
$variation = wc_get_product($variation_id);
$new_product = new WC_Product_Simple();
$new_product->set_name($variation->get_name());
$new_product->set_price($variation->get_price());
$new_product->set_regular_price($variation->get_regular_price());
$new_product->set_sale_price($variation->get_sale_price());
$new_product->set_sku($variation->get_sku());
$new_product->set_stock_quantity($variation->get_stock_quantity());
$new_product->set_manage_stock($variation->get_manage_stock());
$new_product->set_stock_status($variation->get_stock_status());
$new_product->set_description($product->get_description());
$new_product->set_short_description($product->get_short_description());
$new_product->set_category_ids($product->get_category_ids());
$new_product->set_image_id($variation->get_image_id());
$new_product_id = $new_product->save();
// Copy product meta
$meta_data = get_post_meta($variation_id);
foreach ($meta_data as $key => $value) {
update_post_meta($new_product_id, $key, maybe_unserialize($value[0]));
}
}
// Optionally, you can delete the original variable product
wp_delete_post($variable_product_id, true);
}
}
Step 4: Execute the Function
To execute the function and split a specific variable product, you can call the function with the variable product ID. Add the following code snippet to your functions.php file:
/*
* Snippet: How to Split Variable Products Into Simple Products Without a Plugin in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1381
* Tested with WooCommerce 10.7.0
* "Execute the split function on a specific variable product"
*/
add_action('init', 'wcsuccess_execute_split_variable_product');
function wcsuccess_execute_split_variable_product() {
$variable_product_id = 123; // Replace with your variable product ID
wcsuccess_split_variable_product_into_simples($variable_product_id);
}
Make sure to replace 123 with the ID of the variable product you want to split. After executing the function, you can remove or comment out the execution code to prevent it from running again.
Step 5: Verify and Adjust
After splitting the product, verify that the new simple products are created correctly. Check product details, prices, stock status, and categories to ensure everything is accurate.
Conclusion
Splitting variable products into simple products without a plugin can streamline your WooCommerce store’s management and enhance the shopping experience for your customers. By following the steps outlined above, you can achieve this programmatically, maintaining control over your site’s functionality.
For more customization, always consider using a child theme to prevent changes from being overwritten during theme updates. Use our free child theme generator to get started.
This approach ensures your store operates smoothly while offering tailored and specific product listings. Happy selling!
I have been working with WordPress and WooCommerce since 2012 and have developed a deep knowledge of the content management system. Since 2012, I have developed several plugins and designed dozens of websites utilising different frameworks, CMS’s and programming languages. I am proficient in PHP, Python, Java, C, C++, R and JavaScript with limited experience in Go, Kotlin and Swift.
Educationally, I have a Master’s degree in cyber security a Bachelor’s (Hons, First Class) in Applied Research and a Graduate Certificate in Data Science. I’m currently undertaking PhD studies investigating IoT cybersecurity. I recently graduated with First Class Honours and Masters of Information Technology, receiving the Executive Dean’s Award for studies undertaken in the 2021 and 2022 academic years. I have worked in the information technology industry for the past 11 years primarily as a software/web developer specific to design, optimisation, network management and security. My research interests are in the areas of Internet of Things (IoT), 5G and Beyond Networks, information security for wireless networks and software development.
Stay In Touch

