• Resolved walidlahbil

    (@walidlahbil)


    Hello,
    I already created a new stock status “pre_order”, I can add it manually but I don’t know how to import it from a CSV file, the field of stock_status accept only 1 or 0 respectively for “instock” and “outofstock”, How do I set up this field via CSV import?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Have you tried exporting a few products with this new stock status? You will see how it looks in the exported file.

    Thread Starter walidlahbil

    (@walidlahbil)

    Hi @ seank123,

    Yes I have tried and it returns 0 in stock_status, that’s mean it considered like an “outofstock” status.
    This is the code I use it to add my new status :

    function filter_woocommerce_product_stock_status_options( $status ) {
        // Add new statuses
        $status['pre_order'] = __( 'Pre order', 'woocommerce' );
        return $status;
    }
    add_filter( 'woocommerce_product_stock_status_options', 'filter_woocommerce_product_stock_status_options', 10, 1 );
    
    // Availability text
    function filter_woocommerce_get_availability_text( $availability, $product ) {
        // Get stock status
        switch( $product->get_stock_status() ) {
            case 'pre_order':
                $availability = __( 'Pre_order', 'woocommerce' );
            break;
        }
    
        return $availability;
    }
    add_filter( 'woocommerce_get_availability_text', 'filter_woocommerce_get_availability_text', 10, 2 );

    Hello,

    WooCommerce Core CSV file does not have other options for stock, by default it is

    1: Stock
    0: Out of stock

    I understand you would like to add a custom stock status called pre_order.

    There is an extension that might help you with that, called Custom Stock Status, more info is below:

    https://woocommerce.com/products/custom-stock-status/

    This extension includes a 30-days money-back guarantee policy and the possibility to make pre-sales questions.

    There are other plugins as well at the www.ads-software.com repository that might work with custom stock statuses, please check here.

    I hope this helps.

    Thread Starter walidlahbil

    (@walidlahbil)

    Thank you for your response, I figured out without using the plugin

    Hi @walidlahbil

    I’m glad you were able to find a solution to your inquiry here without using any plugin.

    It would be great if you could share it with the community too. ??

    Meanwhile, if you have a few minutes, we’d love it if you could leave us a review:

    https://www.ads-software.com/support/plugin/woocommerce/reviews/

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Is it possible to set product pre-order statuses through a CSV import?’ is closed to new replies.