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:
- 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
- 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.”
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.
Fun stuff! 🎉