Last active
December 10, 2015 11:13
-
-
Save frankschrijvers/06ccd38bc27ff2275bf7 to your computer and use it in GitHub Desktop.
WooCommerce - Add sold out badge on archive pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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