Skip to content

Price-info Widgets on OpenCart 3

Step 1: Open the product.twig file in the following location on your server


Step 2: Find the product price section

Within the product.twig file, find the section of code where the price is displayed.
Below is an excerpt from the product.twig found in the default theme. Your theme may be different.
Note that you would place the widget in the section marked INSERT_WIDGET_HERE

{% if price %}
  <ul class="list-unstyled">
    {% if not special %}
      <h2>{{ price }}</h2>
    {% else %}
    <li><span style="text-decoration: line-through;">{{ price }}</span></li>
      <h2>{{ special }}</h2>
    {% endif %}
    {% if tax %}
    <li>{{ text_tax }} {{ tax }}</li>
    {% endif %}
    {% if points %}
    <li>{{ text_points }} {{ points }}</li>
    {% endif %}
    {% if discounts %}
    {% for discount in discounts %}
    <li>{{ discount.quantity }}{{ text_discount }}{{ discount.price }}</li>
    {% endfor %}
    {% endif %}
{% endif %}

Step 3: Place the following <script> tag into the product.twig file.

Replace PLACE_YOUR_MERCHANT_ID with your unique merchant ID. This will have been provided to you in your welcome email.

If you are unsure of your merchant ID, please reach out to [email protected].

<script src="{%if special%}{{special}}{%else%}{{price}}{%endif%}&merchantID=PLACE_YOUR_MERCHANT_ID"></script>

Try inserting the widget in different places in the code until you find the most suitable place for your site.

Step 4: Save and you should see a working widget on your website.