Skip to content

Instantly share code, notes, and snippets.

@jameskoster
Created November 8, 2012 11:25
Show Gist options
  • Save jameskoster/4038260 to your computer and use it in GitHub Desktop.
Save jameskoster/4038260 to your computer and use it in GitHub Desktop.
WooCommerce 'out of stock' on product archives
// The following goes in functions.php
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_stock', 10);
function woocommerce_template_loop_stock() {
global $product;
if ( ! $product->managing_stock() && ! $product->is_in_stock() )
echo '<p class="stock out-of-stock">out-of-stock</p>';
}
@RussSolberg
Copy link

Which file does this go in? I've added the code to the functions.php file for the plugin-in and didn't see any changes.

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