Refresh theme - Coding for affiliate button instead of buy now button. Hide all prices

Topic summary

Goal: hide prices on home/product pages (except “merchandise” items) and replace Buy Now/Add to Cart with an external “Affiliate Link” button for each product.

Price hiding update:

  • Decision: hide prices when the product price equals 0, ensuring merchandise (with non-zero prices) still shows prices.
  • Implemented by adding a conditional “hidden” class in price.liquid. A syntax correction from “{% end if %}” to “{% endif %}” resolved the issue. OP confirmed this part works.

Affiliate button plan:

  • Requirement: no Add to Cart; each product has a different Amazon/other affiliate URL.
  • Proposed approach: create a product metafield (custom product field) to store the affiliate link; enter the link per product; create/select a new product template that uses this metafield to render an “Affiliate Link” button instead of the cart/buy button.

Alternative suggestion:

  • Use the “Request A Quote – Hide Price by Omega” app (free plan) to hide prices without code.

Status: price hiding solved; affiliate link implementation has clear steps but no confirmation of completion yet. Discussion partially resolved and likely ongoing.

Summarized with AI on January 19. AI used: gpt-5.

URL: https://nft-maxmillion.myshopify.com/

Hi,

I need two things please.

  1. Hide prices on everything on home page and product pages.

Apart from merchandise ( This is linked to a dropshipper)

  1. Change buy now button to Amazon Affiliate / Other affiliate link

Thanks

@LitExtension - Please can you help? I hear you are the master of this theme. Your help would be much appreciated. Thank you :slightly_smiling_face:

Hi @AGConsultancy ,

Please send me the password. I will check it.

1 Like

Hi, I have sent this to you in a DM. Thank you so much.

Hi @AGConsultancy ,

#1: The products you want to hide the price of are all priced at zero?

#2: Are you looking to show this for all products?

1 - Correct. The only page this should not be applied to is the merchandise page.

2 - No add to cart. Just “Affiliate Link”

Thank you.

Hi @AGConsultancy ,

1: Go to price.liquid file and add code here:

Code:

{%- if price == 0 %}hidden {% endif -%}

2: Button will show the same link for products? Or does each product have a different Amazon link?

Hi,

This is the code, I have updated it but it hasn’t done anything.

{% comment %}
Renders a list of product’s price (regular, sale)

Accepts:

  • product: {Object} Product Liquid object (optional)
  • use_variant: {Boolean} Renders selected or first variant price instead of overall product pricing (optional)
  • show_badges: {Boolean} Renders ‘Sale’ and ‘Sold Out’ tags if the product matches the condition (optional)
  • price_class: {String} Adds a price class to the price element (optional)

Usage:
{% render ‘price’, product: product %}
{% endcomment %}
{%- liquid
if use_variant
assign target = product.selected_or_first_available_variant
else
assign target = product
endif

assign compare_at_price = target.compare_at_price
assign price = target.price | default: 1999
assign available = target.available | default: false
assign money_price = price | money
if settings.currency_code_enabled
assign money_price = price | money_with_currency
endif

if target == product and product.price_varies
assign money_price = ‘products.product.price.from_price_html’ | t: price: money_price
endif
-%}

{%- comment -%} Explanation of description list: - div.price__regular: Displayed when there are no variants on sale - div.price__sale: Displayed when a variant is a sale {%- endcomment -%}
{{ 'products.product.price.regular_price' | t }} {{ money_price }}
{%- unless product.price_varies == false and product.compare_at_price_varies %} {{ 'products.product.price.regular_price' | t }} {% if settings.currency_code_enabled %} {{ compare_at_price | money_with_currency }} {% else %} {{ compare_at_price | money }} {% endif %} {%- endunless -%} {{ 'products.product.price.sale_price' | t }} {{ money_price }}
{{ 'products.product.price.unit_price' | t }} {{- product.selected_or_first_available_variant.unit_price | money -}} /  {{ 'accessibility.unit_price_separator' | t }}  {%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%} {{- product.selected_or_first_available_variant.unit_price_measurement.reference_value -}} {%- endif -%} {{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}
{%- if show_badges -%} {{ 'products.product.on_sale' | t }} {{ 'products.product.sold_out' | t }} {%- endif -%}

2 - Different affiliate link - Will be tagged.

Thanks,

Ashleigh

Hi @AGConsultancy ,

1: Please change code:

{%- if price == 0 %}hidden {% endif -%}

=>

{%- if price == 0 %} hidden {% endif -%}

it will work fine

Thank you so much!! - I really appreciate you supplying a solution to the first part.

Hi @AGConsultancy ,

You can follow these steps:

  • Step 1: Create metafield for product’s link.

  • Step 2: Enter the amazon link at the product.

  • Step 3: Create a new template for the product and then select it for the product.

Hope it helps!

@AGConsultancy Can you search Request A Quote - Hide Price by Omega?
The app has a free plan, which can hide all product prices. It seems suitable for your store so you can hide price without touching codes.

Hi AGConsultancy.

I recently also encountered the topic of NFT, maybe it will be useful for you to learn more in detail how to work in this topic.

What is NFT Token: https://romtos.com/learn-more-about-the-product-owner/what-is-nft-token

Read more about how to create your own NFT collection and all related questions here: https://romtos.com/learn-more-about-the-product-owner/how-do-i-create-an-nft-collection

I hope this will be useful for you!