• Resolved DragoWeb

    (@dragoeco)


    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 ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support EtienneP a11n

    (@etiennep)

    This would depend on how you are importing the products. Can you clarify how you are doing that?

    Thread Starter DragoWeb

    (@dragoeco)

    Hi étienne,

    Thanks a lot for your question. I was searching for a solution on the WordPress side, but I should have search on the importing service side. While browsing through the parameters of this service, I found an option that automatically marks the product as “Draft”.

    Merci #ThumbUp

    Plugin Support EtienneP a11n

    (@etiennep)

    Perfect! Thanks for letting me know!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Importing WooCommerce product automatically marked as draft’ is closed to new replies.