• Resolved SLV

    (@dwnl)


    Hello,

    For example, if have a sofa had 80 fabric variations.
    I deleted 40 fabrics from the store.
    But those 40 variations are still in that product under ‘choose any fabric’.

    I exported that sofa as an .csv file. So how can I delete those 40 ‘choose any fabric’ variations via this .csv, so I only have the 40 ones which do have a fabric assigned to them?

    I tried to delete all information in the ‘head’ column (id:*****) for those variations I want to delete, but when importing this csv again I get an error, so this doesn’t work. Error: POST https://www.###.nl/wp-admin/admin-ajax.php 500

    This used to work, but not anymore: https://kristina.blog/2018/05/woocommerce-removing-product-variations-in-bulk/

    Can anybody help me?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    I tried to delete all information in the ‘head’ column (id:*****) for those variations I want to delete, but when importing this csv again

    Deleting the info will make the import likely trip up.

    What you can do instead is to set the Published column for each variation to 0 (not the parent product, but just the product variation). That will cause those variations to be disabled.

    You can also try to set the parent_ID to 0. And then use delete orphans as described in the blog. Do refrain from removing columns or info, instead provide a null value.

    Kind regards,

    Thread Starter SLV

    (@dwnl)

    Hello @conschneider

    What you can do instead is to set the Published column for each variation to 0 (not the parent product, but just the product variation). That will cause those variations to be disabled.
    But still in the products variations. They are not showing now because there is no fabric assigned to them. dis does not delete them

    You can also try to set the parent_ID to 0. And then use delete orphans as described in the blog. Do refrain from removing columns or info, instead provide a null value.
    Parent_ID is head right? Because when importing them, Link with field is set to head automatically.
    I replaced the id:### with: 0
    This does not work. I still get the error

    Plugin Support con

    (@conschneider)

    Engineer

    Hi again,

    > But still in the products variations. They are not showing now because there is no fabric assigned to them. dis does not delete them
    > I replaced the id:### with: 0
    This does not work. I still get the error

    Correct and thanks for trying. I am afraid that is all I got so far. Anything else would involve testing other (paid) plugins or working with a web developer to explore custom code options or going into the database and deleting the variations manually.

    Maybe this method using the REST API is feasible as well: https://stackoverflow.com/questions/62535288/woocommerce-delete-all-variations-using-rest-api

    Take a backup before you attempt anything that triggers a bulk deletion.

    Kind regards,

    Thread Starter SLV

    (@dwnl)

    I have no knowledge of REST API… and I do not want to delete ALL variations, only part of them

    Plugin Support con

    (@conschneider)

    Engineer

    I have no knowledge of REST API… and I do not want to delete ALL variations, only part of them

    Just for the record. The method deletes all variations of a specific product.

    But fair enough. I am afraid that is all I got for now.
    I am gonna keep the thread open for a few days so other people can pitch in.

    Kind regards,

    Thread Starter SLV

    (@dwnl)

    Solved it!

    – Export the columns: ID, SKU, Type, Name, and Parent into a .csv.
    – Delete ALL the ‘variation’ product rows you want to KEEP.
    You can leave or delete the row with the parent ‘Variable’ product.
    – Delete ALL the parent ID’s like id:173565 in the parent column of
    the variations so those cells are empty.
    – Delete ALL the ID’s like 173565 in the ID column in the ‘variations’ rows, so those cells are empty too.
    – Save
    – Import

    • This reply was modified 3 years, 5 months ago by SLV.
    • This reply was modified 3 years, 5 months ago by SLV.
    Thread Starter SLV

    (@dwnl)

    Owh no not solved…

    Plugin Support lionel.a11n

    (@lioneldaniel)

    Hi @dwnl,

    Can you share what exactly didn’t work? With a little more detail someone may be able to help out if the problem is still outstanding.

    Let us know!

    Thread Starter SLV

    (@dwnl)

    Well, let me rephrase the question:

    How to bulk delete product variations in Woocommerce.

    A product has 80 variations, I want to delete 40 of them. I want to keep the other 40.

    How can I delete these 40 in bulk, fast, without a paid plugin?

    Plugin Support lionel.a11n

    (@lioneldaniel)

    Hi @dwnl,

    Your prior procedure of exporting the product, removing the unwanted variations, and uploading it as a new product is mostly correct – I’m not sure why it didn’t work exactly.

    I recommend simply creating a new product with only the variations you want. Use a SKU for the parent product that is used in the parent_id column of the variations. Do not check ‘Update existing products’ during the upload.

    If you want to keep your existing variable product because existing orders refer to them and you want to keep reports, you could either archive the existing product by setting it to ‘Private’ and its catalog visibility to ‘Hidden’.

    If you actually want to remove the variations from the existing product, export the product and Con’s procedure of clearing the parent_id field is correct and should work. You keep only those variations in the CSV, clear the parent_id field, and then update those products with the importer. Then you can remove those orphaned variations with the ‘Delete Orphaned Variations’ tool from WP Admin → WooCommerce → Status → Tools. Here is an article about that idea: https://kristina.blog/2018/05/woocommerce-removing-product-variations-in-bulk/

    Make sure you are using the export/importer located in **Products → Import** and your version of WooCommerce is fully up to date. These techniques are documented and should work – if they don’t, there may be an issue with your site, since it works from my side to try the same procedure.

    We look forward to hearing back from you, and if you have any further questions or details please include those in your reply. Thanks!

    Thread Starter SLV

    (@dwnl)

    I made a brand-new product with only 2 kinds of attributes that are both variation options. In total, there are 20 variations.
    I exported them in a .csv file with only the ID column and the parent-ID column and I empty some parent-ID’s in that column, saved the file and uploaded it.
    And it works fine.

    For the products, where this support ticket is about, I discovered I can only remove 1 parent-ID in that column, save it and upload it. This works.
    If I select more parent-ID’s in that column, and upload it, I get the error:

    jquery.min.js?ver=3.5.1:2 POST https://www.###.nl/wp-admin/admin-ajax.php 500
    send @ jquery.min.js?ver=3.5.1:2
    ajax @ jquery.min.js?ver=3.5.1:2
    s.ajax.s.ajax @ jquery-migrate.min.js?ver=3.3.2:2
    i.run_import @ wc-product-import.min.js?ver=5.4.1:1
    i @ wc-product-import.min.js?ver=5.4.1:1
    t.fn.wc_product_importer @ wc-product-import.min.js?ver=5.4.1:1
    (anonymous) @ wc-product-import.min.js?ver=5.4.1:1
    (anonymous) @ wc-product-import.min.js?ver=5.4.1:1

    If I exported a ‘problem’ product via .csv again, open it in Excel removed some parent-ID’s, saved it, uploaded it and this works fine. But since there are no columns in Excel with this file, editing it is harder.

    Therefore, I normally open the .csv Like so and save it as CSV-UTF8 then upload it. But this gives the POST https://www.###.nl/wp-admin/admin-ajax.php 500 error.
    Why is this not working?

    • This reply was modified 3 years, 4 months ago by SLV.
    Plugin Support lionel.a11n

    (@lioneldaniel)

    Hello @dwnl,

    It sounds like the procedure works with a new product and with your existing product, is that right?

    I’m not sure what you mean that there are not columns in Excel with the file; it should be editable as a CSV spreadsheet in any spreadsheet software (including Excel) without a special workflow. Your export format looks just fine, and I’m able to upload a UTF8 CSV without issue. I’m not sure what issue may be causing your errors or if they are related to the CSV file format.

    I think that given the error, you may be experiencing either an issue with your CSV file or a conflict on your site. To find out:

    1. Please disable all your plugins and activate a default theme such as Twenty-Twenty or Storefront, and see if the error still occurs. This rules out conflicts to narrow down the issue – read our guide on how to test for conflicts for more about conflict testing.
    2. If the problem still happens, please note the exact steps to recreate to issue with only WooCommerce active.
    3. Share the CSV file you are using along with the steps here so we can review them.

    We look forward to hearing back, and I’m sorry that the import process has been giving you such trouble!

    AJ a11n

    (@amandasjackson)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘How to bulk delete product variations via csv’ is closed to new replies.