Importing WooCommerce product automatically marked as draft
-
Hi,
I’m importing products from a platform directly to my shop in a category named “pending”. I have to make some modifications (change image, text, HTML/CSS…) before publishing them so I need all these products to be not published when they’re imported.
I wonder to know if there is a possibility to set automatically all the products from this specific category as “draft”?
I use this snippet (found here) to hide all products from this category but they still appear in some location of my theme (latest product widget, related product…).
add_action( 'woocommerce_product_query', 'bbloomer_hide_products_category_shop' ); function bbloomer_hide_products_category_shop( $q ) { $tax_query = (array) $q->get( 'tax_query' ); $tax_query[] = array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'chairs' ), // Category slug here 'operator' => 'NOT IN' ); $q->set( 'tax_query', $tax_query ); }
Setting all these products as “draft” would be the best solution for me so if anyone could give me a clue on how to achieve this (or if it’s even possible), that would be great ??
- The topic ‘Importing WooCommerce product automatically marked as draft’ is closed to new replies.