Answers for "remove all woocommerce products"

PHP
1

how to delete all products woocommerce in phpmyadmin

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 post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'product');
DELETE FROM wp_posts WHERE post_type = 'product';
Posted by: Guest on November-03-2020
0

how to clear all products woocommerce keep category

-- Delete all WooCommerce products
DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');

-- Delete orphaned postmeta
DELETE pm FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
Posted by: Guest on April-14-2021
0

completely remove woocommerce

define( 'WC_REMOVE_ALL_DATA', true );
Posted by: Guest on February-28-2021
0

remove upsell products woocommerce

remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
Posted by: Guest on May-07-2020

Code answers related to "remove all woocommerce products"

Browse Popular Code Answers by Language