• Resolved robineero

    (@robineero)


    This command lets me to delete 100 WooCommerce products at a time in specific category. How could I delete ALL products within the given category? Or how could I determine the number of products that should be deleted.

    wp post delete $(wp wc product list --user=1 --format=ids --category=64) --force

    Lets say that I have 2000 products to delete and would prefer not having to run deletion command 20 times 🙂

    Thank you!

    • This topic was modified 7 years ago by robineero.
    • This topic was modified 7 years ago by robineero.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter robineero

    (@robineero)

    I got it figured out and posted the solution here in detail.

    This gets the job done.

    for run in {1..2}; do wp post delete $(wp wc product list --user=1 --format=ids --category=64 --per_page=10) --force; done

    Zach W

    (@dynamiczach)

    Automattic Happiness Engineer

    Howdy @robineero!

    Glad to hear you have this resolved, nice job!

    I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP-CLI to delete more than 100 products at a time?’ is closed to new replies.