WooCommerce: Removing Product Variations in Bulk

You have lots of products with lots of variations. Like a T-shirt with 16 different colors and 5 sizes. You’ll no longer be able to offer one of the colors, so you need to remove that option from all the products using that color, but how?
You can select products from the WooCommerce products list, but you can’t select product variations. Do you really have to open each product and do this manually? There doesn’t appear to be a way to do this.
Enter the built in Product Import/Export tool. You can export your product variatons, delete the contents of the parent product field. Re-import – making sure to update (overwrite) the parent product field for the existing products that match by ID or SKU.
Removing the parent product, makes these variations orphans (big surprise!). They won’t show up on your product- which is great. But they will still exist in your database – which is not great. It’s not going to break anything, but it’s better to keep the database neat and tidy. There is a tool in the WooCommerce>Status>Tools area that will allow you delete orphaned variations. Click that button and you’re done.

For more details, see below:

Detailed Explantation:

  • Using the core product import/export tool from the products page, product variations . I recommend selecting just a few columns like ID, SKU, Type, Name, and Parent
    Screen Shot 2018-05-07 at 5.01.39 PM
  • Open the csv. Setup a filter and select the products you want to change.
  • Delete the data in the Parent column.
  • Save as CSV.
  • Import the CSV using the core tool. Make sure to check the box for “Existing products that match by ID or SKU will be updated. Products that do not exist will be skipped.”
    Screen Shot 2018-05-07 at 5.05.26 PM Match all fields.
    This removes the parent of the variation and makes it an “orphan”. The variation will no longer show up on the product, but it will still be in the database, so to keep things clean, follow the next step:
  • Delete orphaned variations: Go to WooCommerce>Status>Tools and click the Delete orphaned variations button. This will delete the variation(s) you just orphaned and remove them from the database. (If you want to double check – you can search for the product ID in the database OR you can try to import the file again (make sure to check that box about updating existing products) that includes the ID of the variation you just deleted. You’ll see that importer will skip that product because there is no matching ID. Screen Shot 2018-05-07 at 5.10.03 PM

Fun stuff! 🎉

8 thoughts on “WooCommerce: Removing Product Variations in Bulk

    • That’s correct. It does make the variations orphans. You need to delete orphaned variations: Go to WooCommerce>Status>Tools and click the Delete orphaned variations button. This will delete the variation(s) you just orphaned and remove them from the database

  1. Hi,
    Thanks for the tips !

    What if instead of just deleting their “parent” columns, we delete the rows corresponding to the variants we no longer want to keep?
    Won’t that clean up the database? Won’t the cleanup of orphan variants take them into account?

    Thanks in advance. I’ve just migrated from Shopify to WooCommerce and must find my marks (bulk edit, etc.) but I’m happy to have “regained my freedom by joining WordPress ; )

    • Yay! Welcome back to WordPress! I felt the same when I had a Shopify store.

      If you delete the rows, nothing will be deleted. The import functionality has to identify which piece of data needs to be deleted. It can’t just delete something because there is no row for it. Imagine if the importer deleted everything in the database connected to a product that _wasn’t_ listed in an import file. Yikes!

      I get where you’re coming from though. It does make logical sense in one way. But functionally it would mean you’d have to include everything in the database in every import and that wouldn’t be practical.

      Thanks for the comment!

  2. Genius! Thanks for this.

    When I went to remove orphaned variations it didn’t have any, but an export of the product catalog no longer had 2,500 duplicates. And they no longer show when editing the product. That works for me.

Leave a Reply to Peter Cancel reply