How can I modify my e-commerce site code for different product buttons?

Topic summary

Goal: display different button text based on product type—“Add to Cart” for regular items (e.g., rings, earrings) and “Book Now” for workshops.

Context: products are tagged; workshops carry a “workshops” tag. Current button code uses Liquid templating and sets aria-label depending on availability, but the visible button text is always “Add to Cart”.

Technical details:

  • Liquid logic present: {% unless current_variant.available %} to handle sold-out state and translation keys via | t.
  • Visible label is hardcoded in as “Add to Cart”.

Key need: add a Liquid condition that checks product tags (e.g., product.tags contains ‘workshops’) to switch the button text and aria-label to “Book Now” for workshops while retaining “Add to Cart” for other items.

Status: no solution provided yet; the request is open.

Central artifact: the code snippet is essential for understanding the required conditional change.

Summarized with AI on February 23. AI used: gpt-5.

Hi guys

I’m currently trying to figure out how to amend this code to suit the following purpose:

I sell both items and workshops. I would like the buttons for my items to be ‘add to cart’, and for my workshops to be ‘book now’.

I’ve made sure that all my items are tagged as specific products (eg, rings, earrings etc) and my workshops tagged as workshops.

Still, I’m unsure how to add a condition to the code that will amend the displayed buttons. Can anyone help?

Here is the current code:

<button type=“submit” name=“add”
{% unless current_variant.available %} aria-disabled=“true”{% endunless %}
aria-label=“{% unless current_variant.available %}{{ ‘products.product.sold_out’ | t }}{% else %}{{ ‘products.product.add_to_cart’ | t }}{% endunless %}”
class=“btn product-form__cart-submit{% if section.settings.enable_payment_button %} btn–secondary-accent{% endif %}”
data-add-to-cart>

{{ ‘Add to Cart’ | json | remove: ‘"’ }}