how to use this variable?

mansimansi Member Posts: 1

Answers

  • JoeyJoey Administrator, Moderator, Lightspeed Staff Posts: 193 moderator

    Hi @mansi

    With these variables you can show the product discount on the product page, this can be discount rules or quantity discounts. For example:

    {% if product.discounts or product.discount_rules %}           
     <ul>
      {% if product.discounts %}
       {% for discount in product.discounts %}
        <li>
            {{ 'Buy $1 for $2 each and save $3' | t (discount.quantity, discount.price | money, discount.percentage | percentage) }}
            {% if discount.unit and shop.settings.legal.mode == 'strict' and shop.settings.price_per_unit == 'enabled' %}
              ({{ discount.unit.price | money }} / {{ discount.unit.unit }})
            {% endif %}
        </li>
      {% endfor %}
     {% endif %}
     {% if product.discount_rules %}
       {% for discount_rule in product.discount_rules %}
         <li>
           <strong>{{ discount_rule }}</strong>
         </li>
        {% endfor %}
       {% endif %}
      </ul>
    {% endif %}
    


    eCom Support Team
    Lightspeed HQ
Sign In or Register to comment.