Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.