Menambahkan SOLD OUT Badge di Woocommerce

First, add the following code to your theme’s Functions.php file:

//Add an out of stock overlay to product images when all variations are unavailable
add_action( ‘woocommerce_before_shop_loop_item_title’, function() {
global $product;
if ( !$product->is_in_stock() ) {
echo ‘Sold Out’;

Next, add the following CSS to your theme’s style.css file:

.sold-out-overlay {
background: #654ea3;
color: #fff;
font-size: 14px;
font-weight: 600;
padding: 5px 10px;
position: absolute;
right: 50px;
top: 10px;