Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save SirDarcanos/f24396f0ed2086192ae6205cd976bb4c to your computer and use it in GitHub Desktop.

Select an option

Save SirDarcanos/f24396f0ed2086192ae6205cd976bb4c to your computer and use it in GitHub Desktop.
add_action( 'woocommerce_after_shop_loop_item_title', 'custom_print_stock', 9 );
function custom_print_stock() {
global $product;
printf( '<span>Available: %d</span>', esc_html( $product->get_stock_quantity() ) );
}
@852cmd
Copy link
Copy Markdown

852cmd commented Apr 26, 2016

Hi, can you make this to work on single products only and the text that says the WooCommerce default which is this: "[smiley face] Only x left in stock"? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment