WooCommerce: How to add Sold Out badge on product loop & single pro

Posted in: Newspaper
Post count: 5

Hello,

I’m using Newspaper with WooCommerce and trying to display a “Sold Out” badge/overlay on products that are out of stock.

I’ve already added hooks in my child theme’s functions.php (e.g. woocommerce_before_shop_loop_item_title and woocommerce_before_single_product_summary) but they don’t output anything, because Newspaper overrides the WooCommerce templates.

Could you please let me know:

Which Newspaper template file(s) handle the product loop and the single product layout so I can safely add my custom code in the child theme?

Is there a Newspaper-specific hook/action I should use to inject a “Sold Out” badge instead of standard WooCommerce hooks?

My goal: when a product is Out of Stock, show a <span class=”sold-out-overlay”>Sold Out</span> on the product thumbnail in the shop/category view, and on the featured image in the single product page.

Thanks in advance for clarifying the correct place to override/add this.

Post count: 35449

Hi,
Unfortunately, there is no option for this, sorry!
This can be achieved only with custom code.
Thank you for your understaing!

Post count: 5

please can you guide me
send me code
i will put in my child theme

Post count: 35449

Hi,
I’ve been searching for some plugins and came across this one – Woo Custom Stock Status
. It might not be exactly what you need, but it seems to be pretty close.

Post count: 5

i have try a lot without plugin
in child theme can we do get some please i try a lot

Post count: 5

i put with sold out badge in image manualy
https://luxuryinteriorstudio.com/product/the-wooden-eclipse/

Post count: 35449

Hi,

The solution you used is more of a workaround.
One of the simplest and most effective ways to achieve your goal is by using an additional plugin. I found a plugin that offers a similar solution to what you’ve implemented: – https://fooplugins.com/woocommerce-out-of-stock-badge/

Alternatively, a custom implementation is possible, but it would require the help of a developer. It involves using a hook to check the database and determine whether the displayed product is out of stock.

Thank you!

Post count: 5

i am developer so what should i do please provide me full code i had made child theme too

Post count: 35449

Hi,
Unfortunately, I’m not a developer, and this request goes beyond the scope of what I can support. If I had a specific code solution available, I would have already shared it. That’s why I mentioned that you’ll need a developer if you want to achieve this through custom code.

However, I did suggest an alternative approach using a plugin that might help.

Thank you!

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.