Site logo

[Support request] How to add stock status to product page?

Home Forums Support [Support request] How to add stock status to product page?

Home Forums Support How to add stock status to product page?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2523087
    Konstantin

    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

    #2523214
    David
    Staff
    Customer Support

    Hi there,

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

    #2523221
    Konstantin

    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.

    #2524156
    David
    Staff
    Customer Support

    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/

    #2524214
    Konstantin

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

    #2524368
    David
    Staff
    Customer Support

    I tested that PHP Snippet on my test dev site, and it worked for me:

    2023-02-07_12-29-38

    Can i see your site ?

    #2524679
    Konstantin
    #2524753
    David
    Staff
    Customer Support

    The code i provided here

    Is it still added to your site ?

    #2524782
    Konstantin

    Yes

    #2524805
    David
    Staff
    Customer Support

    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.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.