Site logo

Archived topic

How to add stock status to product page?

9 replies · Started by Konstantin on February 6, 2023

Viewing posts 1–10 of 10

Hello
There is a problem. The product category page has a stock status, but the product page does not.
Stock status is custom. Manage stock plugin - Custom Stock Status

Hi there,

can you ask the author of the Custom Stock Status plugin how to display that value?

The functionality of the plugin provides for displaying the stock status on the product page.
I thought I needed to put in a code. Because without this plugin your theme doesn't display stock anywhere.

Add this PHP Snippet to your site:

// Show stock status on single product
add_action( 'woocommerce_single_product_summary', function(){
    global $product;
    echo wc_get_stock_html( $product );
}, 10 );

It will display the stock status on the single product.

How to add PHP: https://docs.generatepress.com/article/adding-php/

Thanks. But not work. Still not display stock status on the product page.

The code i provided here

Is it still added to your site ?

Yes

Then i can only assume that some other plugin is affecting that code.
That code is 100% woocommerce, its not theme specific, and it works on my woo dev site.

This archived topic is closed to new replies.