New Shopify Certification now available: Liquid Storefronts for Theme Developers

Change "Add to cart" button to "Download" on specific products

SuenosBeats
Tourist
9 0 2

How would I go about changing the "Add To Cart" Button to say "Download Now" for the free digital products we're offering on the store.

 

I would like to change this for specific products only, not all of them. 

 

 

Screenshot_2.png

Reply 1 (1)
PaulNewton
Shopify Partner
5931 537 1241

@SuenosBeats You'd have to find the relevant area of code, product-info.liquid, buy-buttons.liquid etc and find the text translation output to wrap it in liquid logic.

 

If you need this customization then contact me directly by mail for services.
Please always provide context, examples: store url, theme name, post url(s) , or any further detail.
Contact Info in signature.

 

Either use the product handles,  a specific tag, or use an alternate template to indicate these different products.

 

Example location for Dawn themes

https://github.com/Shopify/dawn/blob/main/snippets/buy-buttons.liquid#L91 

and example logic

<span>
 {%- if product.selected_or_first_available_variant.available == false or quantity_rule_soldout -%}
  {{ 'products.product.sold_out' | t }}
{%- else -%}
 {% if product.template_suffix == "downloads" %}
  Download
 {% else %}
  {{ 'products.product.add_to_cart' | t }}
 {%- endif -%}
{%- endif -%}
</span>

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org