{"id":3722,"date":"2019-04-09T08:45:23","date_gmt":"2019-04-09T07:45:23","guid":{"rendered":"https:\/\/www.utilewebsites.nl\/?post_type=wz_knowledgebase&#038;p=3722"},"modified":"2019-04-09T08:57:09","modified_gmt":"2019-04-09T07:57:09","slug":"woocommerce-delete-all-orders-delete-all-products-delete-all-customers","status":"publish","type":"wz_knowledgebase","link":"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/","title":{"rendered":"WooCommerce Delete all Orders, Delete all products, Delete all Customers"},"content":{"rendered":"\n<p><br><\/p>\n\n\n\n<p>\nWe have tested the queries below in :\n\n<\/p>\n\n\n\n<p>WooCommerce version: 3.5.7<br> WordPress version: 5.1.1 <br><br>( Use at own risk )<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>=======================<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Delete all orders woocommerce<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DELETE FROM wp_woocommerce_order_itemmeta;<br>\nDELETE FROM wp_woocommerce_order_items;<br>\nDELETE FROM wp_comments WHERE comment_type = 'order_note';<br>\nDELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' );<br>\nDELETE FROM wp_posts WHERE post_type = 'shop_order';<\/pre>\n\n\n\n<p>==========================<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">delete all products<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DELETE relations.<em>, taxes.<\/em>, terms.*<br>\nFROM wp_term_relationships AS relations<br>\nINNER JOIN wp_term_taxonomy AS taxes<br>\nON relations.term_taxonomy_id=taxes.term_taxonomy_id<br>\nINNER JOIN wp_terms AS terms<br>\nON taxes.term_id=terms.term_id<br>\nWHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product');<br>\nDELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'product');<br>\nDELETE FROM wp_posts WHERE post_type = 'product';<\/pre>\n\n\n\n<p>==========================<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Remove all attributes from WooCommerce<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%');<br> DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%';<br> DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);<\/pre>\n\n\n\n<p>==========================<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Delete all WooCommerce products (2)<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));<br>\nDELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));<br>\nDELETE FROM wp_posts WHERE post_type IN ('product','product_variation');<\/pre>\n\n\n\n<p>==========================<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Delete orphaned postmeta<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DELETE pm<br>\nFROM wp_postmeta pm<br>\nLEFT JOIN wp_posts wp ON wp.ID = pm.post_id<br>\nWHERE wp.ID IS NULL;<\/pre>\n\n\n\n<p>==========================<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">delete all categories<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DELETE a,c FROM wp_terms AS a<br>\nLEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id<br>\nLEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id<br>\nWHERE c.taxonomy = 'product_tag';<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">DELETE a,c FROM wp_terms AS a<br>\nLEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id<br>\nLEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id<br>\nWHERE c.taxonomy = 'product_cat';<\/pre>\n\n\n\n<p>==========================<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Delete alle WooCommerce customers \/ Users<\/h3>\n\n\n\n<p>You Can delete alle WooCommerce customers \/ users with this plugin :<\/p>\n\n\n\n<p> <blockquote class=\"wp-embedded-content\" data-secret=\"0uxykmJHrI\"><a href=\"https:\/\/nl.wordpress.org\/plugins\/bulk-delete\/\">Bulk Delete<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Bulk Delete&#8221; &#8212; Plugin Directory\" src=\"https:\/\/nl.wordpress.org\/plugins\/bulk-delete\/embed\/#?secret=6BJfWhfUAi#?secret=0uxykmJHrI\" data-secret=\"0uxykmJHrI\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"562\" src=\"https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/04\/Screenshot_2019-04-09-Delete-Users-\u2039-DoubleDaves-Cues-\u2014-WordPress-1024x562.png\" alt=\"\" class=\"wp-image-3731\" srcset=\"https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/04\/Screenshot_2019-04-09-Delete-Users-\u2039-DoubleDaves-Cues-\u2014-WordPress-1024x562.png 1024w, https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/04\/Screenshot_2019-04-09-Delete-Users-\u2039-DoubleDaves-Cues-\u2014-WordPress-300x165.png 300w, https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/04\/Screenshot_2019-04-09-Delete-Users-\u2039-DoubleDaves-Cues-\u2014-WordPress-768x422.png 768w, https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/04\/Screenshot_2019-04-09-Delete-Users-\u2039-DoubleDaves-Cues-\u2014-WordPress.png 1435w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have tested the queries below in : WooCommerce version: 3.5.7 WordPress version: 5.1.1 ( Use at own risk ) ======================= Delete all orders woocommerce DELETE FROM wp_woocommerce_order_itemmeta; DELETE FROM wp_woocommerce_order_items; DELETE FROM wp_comments WHERE comment_type = 'order_note'; DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' ); DELETE FROM wp_posts WHERE post_type = 'shop_order'; ========================== delete all products DELETE relations., taxes., terms.* FROM wp_term_relationships AS relations INNER JOIN wp_term_taxonomy AS taxes ON relations.term_taxonomy_id=taxes.term_taxonomy_id INNER JOIN wp_terms AS terms ON taxes.term_id=terms.term_id WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product'); DELETE FROM wp_postmeta WHERE&nbsp;<a href=\"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/\" class=\"read-more\">Continue Reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"wzkb_category":[68],"wzkb_tag":[],"class_list":["post-3722","wz_knowledgebase","type-wz_knowledgebase","status-publish","hentry","wzkb_category-woocommerce"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>WooCommerce Delete all Orders, Delete all products, Delete all Customers - Utilewebsites<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WooCommerce Delete all Orders, Delete all products, Delete all Customers - Utilewebsites\" \/>\n<meta property=\"og:description\" content=\"We have tested the queries below in : WooCommerce version: 3.5.7 WordPress version: 5.1.1 ( Use at own risk ) ======================= Delete all orders woocommerce DELETE FROM wp_woocommerce_order_itemmeta; DELETE FROM wp_woocommerce_order_items; DELETE FROM wp_comments WHERE comment_type = &#039;order_note&#039;; DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = &#039;shop_order&#039; ); DELETE FROM wp_posts WHERE post_type = &#039;shop_order&#039;; ========================== delete all products DELETE relations., taxes., terms.* FROM wp_term_relationships AS relations INNER JOIN wp_term_taxonomy AS taxes ON relations.term_taxonomy_id=taxes.term_taxonomy_id INNER JOIN wp_terms AS terms ON taxes.term_id=terms.term_id WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type=&#039;product&#039;); DELETE FROM wp_postmeta WHERE&nbsp;Continue Reading\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/\" \/>\n<meta property=\"og:site_name\" content=\"Utilewebsites\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-09T07:57:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/04\/Screenshot_2019-04-09-Delete-Users-\u2039-DoubleDaves-Cues-\u2014-WordPress-1024x562.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/knowledgebase\\\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\\\/\",\"url\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/knowledgebase\\\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\\\/\",\"name\":\"WooCommerce Delete all Orders, Delete all products, Delete all Customers - Utilewebsites\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/#website\"},\"datePublished\":\"2019-04-09T07:45:23+00:00\",\"dateModified\":\"2019-04-09T07:57:09+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/knowledgebase\\\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/knowledgebase\\\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/knowledgebase\\\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Knowledge Base\",\"item\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/knowledgebase\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"WooCommerce Delete all Orders, Delete all products, Delete all Customers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/\",\"name\":\"Utilewebsites\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/#organization\",\"name\":\"Utilewebsites\",\"url\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.utilewebsites.nl\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/logo-Utilewebsites-2017.png\",\"contentUrl\":\"https:\\\/\\\/www.utilewebsites.nl\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/logo-Utilewebsites-2017.png\",\"width\":3000,\"height\":593,\"caption\":\"Utilewebsites\"},\"image\":{\"@id\":\"https:\\\/\\\/www.utilewebsites.nl\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WooCommerce Delete all Orders, Delete all products, Delete all Customers - Utilewebsites","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/","og_locale":"en_US","og_type":"article","og_title":"WooCommerce Delete all Orders, Delete all products, Delete all Customers - Utilewebsites","og_description":"We have tested the queries below in : WooCommerce version: 3.5.7 WordPress version: 5.1.1 ( Use at own risk ) ======================= Delete all orders woocommerce DELETE FROM wp_woocommerce_order_itemmeta; DELETE FROM wp_woocommerce_order_items; DELETE FROM wp_comments WHERE comment_type = 'order_note'; DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' ); DELETE FROM wp_posts WHERE post_type = 'shop_order'; ========================== delete all products DELETE relations., taxes., terms.* FROM wp_term_relationships AS relations INNER JOIN wp_term_taxonomy AS taxes ON relations.term_taxonomy_id=taxes.term_taxonomy_id INNER JOIN wp_terms AS terms ON taxes.term_id=terms.term_id WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product'); DELETE FROM wp_postmeta WHERE&nbsp;Continue Reading","og_url":"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/","og_site_name":"Utilewebsites","article_modified_time":"2019-04-09T07:57:09+00:00","og_image":[{"url":"https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/04\/Screenshot_2019-04-09-Delete-Users-\u2039-DoubleDaves-Cues-\u2014-WordPress-1024x562.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/","url":"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/","name":"WooCommerce Delete all Orders, Delete all products, Delete all Customers - Utilewebsites","isPartOf":{"@id":"https:\/\/www.utilewebsites.nl\/en\/#website"},"datePublished":"2019-04-09T07:45:23+00:00","dateModified":"2019-04-09T07:57:09+00:00","breadcrumb":{"@id":"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/woocommerce-delete-all-orders-delete-all-products-delete-all-customers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.utilewebsites.nl\/en\/"},{"@type":"ListItem","position":2,"name":"Knowledge Base","item":"https:\/\/www.utilewebsites.nl\/en\/knowledgebase\/"},{"@type":"ListItem","position":3,"name":"WooCommerce Delete all Orders, Delete all products, Delete all Customers"}]},{"@type":"WebSite","@id":"https:\/\/www.utilewebsites.nl\/en\/#website","url":"https:\/\/www.utilewebsites.nl\/en\/","name":"Utilewebsites","description":"","publisher":{"@id":"https:\/\/www.utilewebsites.nl\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.utilewebsites.nl\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.utilewebsites.nl\/en\/#organization","name":"Utilewebsites","url":"https:\/\/www.utilewebsites.nl\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.utilewebsites.nl\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/08\/logo-Utilewebsites-2017.png","contentUrl":"https:\/\/www.utilewebsites.nl\/wp-content\/uploads\/2019\/08\/logo-Utilewebsites-2017.png","width":3000,"height":593,"caption":"Utilewebsites"},"image":{"@id":"https:\/\/www.utilewebsites.nl\/en\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/wz_knowledgebase\/3722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/wz_knowledgebase"}],"about":[{"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/types\/wz_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/comments?post=3722"}],"version-history":[{"count":10,"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/wz_knowledgebase\/3722\/revisions"}],"predecessor-version":[{"id":3735,"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/wz_knowledgebase\/3722\/revisions\/3735"}],"wp:attachment":[{"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/media?parent=3722"}],"wp:term":[{"taxonomy":"wzkb_category","embeddable":true,"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/wzkb_category?post=3722"},{"taxonomy":"wzkb_tag","embeddable":true,"href":"https:\/\/www.utilewebsites.nl\/en\/wp-json\/wp\/v2\/wzkb_tag?post=3722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}