Last active
December 10, 2015 11:13
-
-
Save frankschrijvers/d4b17a00c01a57c1db38 to your computer and use it in GitHub Desktop.
WooCommerce - Add sold out badge on single product 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 single product pages | |
add_action( 'woocommerce_before_single_product_summary', 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