Support » Plugin: YITH Pre-Order for WooCommerce » Remove “In Stock” status

  • In order for the this plugin to work, I choose the pre-order option and change the inventory above 0 products.

    But now, on the single product page, there remains the “In stock” status even though there is no real inventory.

    How do I add the following as part of a filter to my functions page in order to hide the “In stock” message when the pre-order option has been enabled?

    $pre_order = new YITH_Pre_Order_Product( $product_id );
    $is_preorder = $pre_order->get_pre_order_status();

Viewing 1 replies (of 1 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi @polyfade ,
    Try to add this custom code in your functions.php

    if ( defined( 'YITH_WCPO_FREE_INIT' ) ) {
        add_filter( 'woocommerce_get_stock_html', 'yith_ywpo_hide_stock', 10, 2 );
    
        function yith_ywpo_hide_stock( $html, $product ) {
            if ( class_exists( 'YITH_Pre_Order_Product' ) ) {
                $pre_order = new YITH_Pre_Order_Product( $product );
                if ( 'yes' == $pre_order->get_pre_order_status() ) {
                    $html = '';
                }
            }
            return $html;
        }
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Remove “In Stock” status’ is closed to new replies.