How do i add "last piece" badge in taste theme?

Topic summary

A user wants to add a “last piece” badge to their Taste theme that displays when only one item remains in stock, similar to how a “sold out” badge appears. Only one badge should show at a time.

Proposed Solutions:

  • Code snippet approach: One responder provided Liquid code that checks inventory quantity and displays “Last Piece” when inventory_quantity == 1. The code uses current_variant to check availability and stock levels.

  • App-based solution: Another suggestion recommends using the Easy Stock Shopify app, which can add “Only 1 left” badges over product images.

Outstanding Questions:

  • The original poster needs clarification on which theme file to paste the code into
  • How to change the badge label color

The discussion remains open as implementation details are still being worked out.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

similar to a “sold out” badge but I would like to add-on another badge called “last piece” and only display 1 badge at a time. so for example if the product left 1 piece, it will show “last piece” and if it’s sold, it will show “sold out”

im currently using taste theme by shopify

https://twoofusco.store/

1 Like

Hi @twoofusco ,

We do have to use similar code to show the badges.

{% assign current_variant = product.selected_or_first_available_variant %}
  
  {% if current_variant.available %}
    {% if current_variant.inventory_quantity == 1  %}
     Last Piece
    {% endif %}
  {% endif %}

Please don’t hesitate to reach out if you need further help optimizing or customizing your store. If you find this information useful, a Like would be greatly appreciated. And if this solves the problem, please Mark it as Solution!

Best Regards,
LuffyOnePiece

Hello @twoofusco ,

I understand you are looking to provide a ‘Last Piece’ badge similar to the ‘Sold Out’ badge in the products with less quantity or only 1 item left.

You can use a Shopify app to add different badges.

As with the help of this app https://apps.shopify.com/easy-stock , you can add a ‘Only 1 left’ badge over the product images, kindly take a look.

I hope it helps.

Thank you.

hi @LuffyOnePiece ! thank you, may I know which file should I paste this code to? And how do I change the colour for the label as well?