phpopencartopencart-3opencart-moduleopencart-events

How to show total reward points on checkout page in Opencart 3.0


I using Opencart 3.0, I just want to show the total sum of reward points (I have renamed as BV Points) of the complete order on the checkout page as shown in the attached image. I don't want to purchase any paid plugin for it. Only I just want to show the total points at the bottom on the checkout page rest all are useless for me. Please help me

enter image description here

enter image description here


Solution

  • The easiest way to do that ..

    In file: catalog/view/theme/{THEME_DIRECTORY}/template/checkout/cart.twig

    Replace:

    {% for product in products %}
    

    By:

    {% set points = 0 %}
    {% for product in products %}
    {% if product.reward %}
    {% set points = points + product.reward|replace({'BV Points: ':''})  %}
    {% endif %}
    

    And then add:

    <tr>
      <td><strong>Total points:</strong></td>
      <td class="text-left" dir="ltr">{{ points }}</td>
    </tr>
    

    before:

    {% for total in totals %}