Product price on landing page

New Member
1 0 0

Hi all, 

I'm trying to add a price to my landing page for one of the products. I want it to automatically update if I update the price in the system (discounts, compare price, etc.).

I tried copying the code from product-main.liquid and some other codes but nothing works as I'm not on a product page but on regular one (.../pages/my-landing-product).
Can anyone help me solve that?

 

This is the code on my product page for the price (it works great there):

{% capture product_price_markup %}
  <div class="product-price">
    <span class="price">
      <span class="money">{{ price | money }}</span>
      {% unless product.variants.size == 1 and product.compare_at_price_min <= selectedVariant.price %}
        <span
          class="
            product-price-compare
            {% if product.compare_at_price_min <= selectedVariant.price or onboarding %}hidden{% endif %}
          "
        >
          <span class="original money">
            {% if selectedVariant.compare_at_price > selectedVariant.price %}
              {{ selectedVariant.compare_at_price | money }}
            {% endif %}
          </span>
          <span class="saving">
            {% if selectedVariant.compare_at_price > selectedVariant.price %}
              <span> {{ "products.product.saving" | t }} </span>
              <span class="saving-result money">
                {{ selectedVariant.compare_at_price | minus: selectedVariant.price | money }}
              </span>
            {% endif %}
          </span>
        </span>
      {% endunless %}
    </span>
  </div>
{% endcapture %}

 

0 Likes