StockTrack lets you show customers where products are available. This is optional, and it uses a shortcode that you can place anywhere on the product page.
Supporting Variable Products
When used on variable products, the shortcode updates dynamically when a variation is selected.
Customers will only see locations and stock relevant to the chosen variation.
No additional configuration is needed.
Shortcode
Use the shortcode below to show stock by location:
[stocktrack_availability stock_values="true" max_display="10"]
Parameters
- stock_values=”true”
Shows exact quantities, for example:
Los Angeles — 9 in stock - stock_values=”false”
Hides quantities and only shows availability:
Los Angeles — in stock - max_display=”10″
Caps the number shown.
If actual stock is higher (for example 500), the output becomes:
Los Angeles — 10+ in stock - expanded_locations=”false” (default)
If false: locations are hidden until the customer clicks the toggle button
if true: locations are visible immediately when the product loads
You can add the shortcode to product descriptions, custom blocks, templates, or a snippets plugin.

Auto-Display on Product Pages (Code Example)
If you want StockTrack availability to automatically appear below the product summary, you can add this snippet using a code snippets plugin or in your theme’s functions.php.
add_action( 'woocommerce_single_product_summary', 'stocktrack_show_availability_in_product_page', 25 );
add_filter( 'woocommerce_get_stock_html', 'stocktrack_maybe_hide_stock_status', 10, 2 );
/**
* Auto-display StockTrack availability below product summary.
*
* To disable, remove this hook or wrap in a conditional.
*/
function stocktrack_show_availability_in_product_page() {
if ( ! is_product() ) {
return;
}
global $product;
if ( ! is_a( $product, 'WC_Product' ) ) {
return;
}
echo do_shortcode( '[stocktrack_availability stock_values="true" max_display="10"]' );
}
/**
* Hide WooCommerce stock field when using StockTrack locations.
*/
function stocktrack_maybe_hide_stock_status( $html, $product ) {
if ( is_product() ) {
return ''; // Hide default WooCommerce stock display
}
return $html;
}
Hiding WooCommerce’s Stock Display
If you use the shortcode, you likely want to hide the default WooCommerce stock message to avoid duplicates.
This is already handled in the snippet above, but you can use the filter alone if needed:
add_filter( 'woocommerce_get_stock_html', function() {
return '';
});
Notes
- Frontend display is optional
- Customers only see what you choose to show
- The shortcode works on simple and variable products
- You can style the output with your theme’s CSS if needed