Support » Plugin: WooCommerce » WP-CLI to delete more than 100 products at a time?

  • Resolved Robert

    (@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 2 days, 15 hours ago by  Robert.
    • This topic was modified 2 days, 14 hours ago by  Robert.
Viewing 2 replies - 1 through 2 (of 2 total)
  • 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

    Plugin Support 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)
  • You must be logged in to reply to this topic.