1 year ago

#372934

test-img

Krzysztof Pietryga

Custom stock status to products on shop page - woocomerce

I use this solution How to add custom stock status to products in WooCommerce 4+ on my page.

I try to use this custom status on shop page. But on shop page I get only two status in stock and out of stock.

add_filter('woocommerce_get_price_html', 'uni_price', 9999, 2);

function uni_price($price, $product) {

global $product;

// Is a WC product
if (is_a($product, 'WC_Product')) {
    // Get stock status
    $product_stock_status = $product->get_stock_status();
    // Compare
    if ($product_stock_status == 'Coming soon') {
        $price = '<span class="woocommerce-Price-amount amount tbdprice com">Coming soon</span>';
    }
}

return $price;

}

Someone who can assist me with this?

php

wordpress

woocommerce

status

stock

0 Answers

Your Answer

Accepted video resources