Previously, the “Sold Out” badge appeared on the collection page of my store. However, now we need to click on the product to see if it is sold out. I’m using the Impulse theme.
Does anyone have a solution for this issue? I would greatly appreciate any help you can provide.
To display the “Sold Out” badge on the collection page in the Impulse theme, you may need to modify the theme’s code to ensure that the badge appears next to products that are out of stock. Here’s how you can achieve this:
Go to the Theme Editor:
From your Shopify admin, navigate to Online Store > Themes.
Find the Impulse theme and click on Actions > Edit code.
Locate the Product Loop Code:
In the code editor, search for the file that controls the display of products in the collection. Typically, this is located in sections/collection-template.liquid or sections/product-grid.liquid.
Add the Sold Out Badge:
Look for the section where the product’s image is displayed within the loop (e.g.,
).
You’ll need to add a condition to check whether the product is out of stock and display the “Sold Out” badge accordingly. For example, you can use the following Liquid code:
{% if product.available == false %} Sold Out
{% endif %}
Add this snippet inside the product grid loop, typically right after the product image or title, so it appears on the collection page.
Style the Badge (optional):
You may want to add custom styles to ensure the “Sold Out” badge looks good. In the assets folder, find the theme.css or theme.scss.liquid file and add a CSS rule for the .sold-out-badge class, like this:
.sold-out-badge {
position: absolute;
top: 10px;
right: 10px;
background-color: red;
color: white;
padding: 5px 10px;
font-weight: bold;
border-radius: 5px;
}
Save and Preview:
After adding the code and styling, click Save and preview your store to ensure the “Sold Out” badge appears on the collection page.
This should restore the functionality of the “Sold Out” badge without needing to click on individual products. Let me know if you need further assistance!
Thank you @Ahmad31 . Is this copy from ChatGPT? If yes, please let me know, because ChatGPT doesn’t provide completely accurate answers as it cannot review the Impulse theme code like a human can.
If the issue isn’t fully resolved or if you’d like further assistance with the Impulse theme, feel free to reach out. I’m happy to help you troubleshoot and make sure everything works as expected! Just let me know if you need any adjustments.
I’m Amanda from the Fordeer Team. In this scenario, consider utilizing an app such as Product Labels & Badges. It can assist you in displaying labels automatically.