Can we mention out of stock of products from product list page?

WCMp Advanced Frontend Manager

Can we mention out of stock of products from product list page? Open

Viewing 1 reply thread
  • Author
    Posts
    • #110353
      help
      Participant

      Hello,

      I’d like to mention on the product list page of my website when a product is out of stock.
      For now, it’s mentionned only when you enter the product sheet.

      I’d like to mention it like in the file attached.

      How can I do this?

      Thank you

    • #110415
      abhirup
      Moderator

      Hi,
      Please add this code in the function.php of the current active theme :

      add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_display_sold_out_loop_woocommerce', 7 );
       
      function bbloomer_display_sold_out_loop_woocommerce() {
          global $product;
       
          if ( !$product->is_in_stock() ) {
              echo   __( 'SOLD OUT', 'woocommerce' ).'<br>';
          }
      }
      Copy

      Regards,

Viewing 1 reply thread

Please LOGIN to reply to this topic

Buy all Marketplace addons together, check out our Bundle

Buy at Slashed Price