0

Due to some requirements, I had to make a change so the price for a variable product replace the price range. However, the stock status remains visible after the variations dropdown. Is there a way to remove it from there or use a hook/action to move it after the price?

If this is not possible with code, I can move it with this function

add_action( 'woocommerce_before_variations_form', 'wc_echo_stock_variations_loop');

function wc_echo_stock_variations_loop() {

    global $product;
    if ( $product->get_type() == 'variable' ) {
        //var_dump($product->get_availability());
        echo '<div class="woocommerce-variation single_variation wd-show">
                <div class="woocommerce-variation-availability"><p class="stock in-stock wd-style-with-bg"><span>Налично</span></p>
                </div>
                </div>';
    }
}

and use add_filter( 'woocommerce_get_stock_html', '__return_empty_string'); to remove the stock message but how can I exclude the function from this filter?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.