

please copy this to your function.php
add_shortcode( ‘stockis’, ‘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”>🟢</p>’;
} else {
$html = ‘<p class=”stock out-of-stock”>🔴</p>’;
}
}
return $html;
}
use the shortcode [stockis] wherever you want to show the color bullets