WooCommerce Sold Out badge

Reader Interactions


  1. Andrea says

    Thank you, this is exactly what I need it. it works perfect. I changed the “sold out” text for “coming soon”, easy to adapt.

  2. Andy says


    Thank you for this post, very helpful.

    I wonder if you could suggest a fix? I did everything as you said, but on my product page the badge floats in the header to the right, and also the badge displays over the title. My store is http://shop.kandagadgets.com if you could possibly advise?

    Many thanks for your time and help

    • Frank Schrijvers says

      It’s hard to say how to fix this without an example. Maybe you can try a different hook or you have to add position relative to the product div.

  3. [email protected] says

    Somehow this doesnt work right in case of variable products. Its shows the badge even if some variables (like size or color) are on stock and some are not

  4. Davide says

    The code is great
    How to translate it whit polylang or Loco translate?

  5. Saïd says

    Thanks for the quick snippet. One buggy issue (def on my end):

    //* Add sold out badge on archive pages
    add_action( 'woocommerce_before_shop_loop_item_title', function() {
    global $product;
    if ( !$product->is_in_stock() ) {
    echo 'Sold out';

    The above snippet doesn’t display on every product that is sold out on the shop page, only the 2nd snippet that shows on every product page is working properly.