Skip to content

Instantly share code, notes, and snippets.

@frankschrijvers
Last active December 10, 2015 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankschrijvers/06ccd38bc27ff2275bf7 to your computer and use it in GitHub Desktop.
Save frankschrijvers/06ccd38bc27ff2275bf7 to your computer and use it in GitHub Desktop.
WooCommerce - Add sold out badge on archive pages
<?php
//* Do NOT include the opening php tag
//* Add sold out badge on archive pages
add_action( 'woocommerce_before_shop_loop_item_title', function() {
global $product;
if ( !$product->is_in_stock() ) {
echo '<span class="soldout">Sold out</span>';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment