The Worlds Most Powerful
WordPress Builder

If you Purchased & Registered a Slider Revolution License you can comfortably upgrade version 5.x to 6.0 from your WordPress Dashboard.

Why Activate Slider Revolution?

Activating Slider Revolution with your Personal Purchase Code will unlock all available Features.

Easy Live Updates
Personal License Key
200+ Template Library
1000+ Object Library
25+ Amazing Add-Ons
1on1 Ticket Support

*Regular License from $29. One License Key required per Domain.

Slider Revolution 6.0 NOW available!

This article will show you a method to display the stock status on a WooCommerce Product Grid Item.

Quick Note:

Refer to this article that explains how to create a WooCommerce Product Grid

Step 1: Insert the custom PHP code below into your theme functions.php file or with the Code Snippets Plugin

add_shortcode( 'stock_status', 'display_product_stock_status' );
function display_product_stock_status( $atts) {
    $atts = shortcode_atts(
        array('id'  => get_the_ID() ),
        $atts, 'stock_status'
if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
    $product = wc_get_product( $atts['id'] );
    $stock_status = $product->get_stock_status();
    if ( 'instock' == $stock_status) {        
$html = '<p class="stock in-stock">In stock</p>';  
    } else {
$html = '<p class="stock out-of-stock">Out of stock</p>';      
return $html;

Step 2: Edit the WooCommerce Product Grid Skin.

Step 3: Create a new Layer and select Text/HTML as Layer Source.

Step 4: Replace the Layer Texts with the shortcode below in the "Text/HTML" source

[stock_status id='%post_id%']

Popular Solutions