Cart template

When changeing product quantity or deleting a product from cart, changes will be triggered on cartProductsHtmlChanged function which has the updated html of the cart template (template_for_cart_products_list) and cart object as parameters. Also, you need to add the {{ cart_view_scripts|raw }} at footer scripts block

1 - Add cart products list template

<div class="cart__items">
  <div class="template_for_cart_products_list">
    {{ template_for_cart_products_list }}
  </div>
</div>

2 - Add cart view script in footer scripts block

3- Add cartProductsHtmlChanged event function in script tag

{% block footer_scripts %}

    {{ cart_view_scripts|raw }}
    
    <script>
       function cartProductsHtmlChanged(html, cart) {
          console.log(cart.products_count)
       }
       
       // reset cart html
       $('.template_for_cart_products_list').html(html);
       
    </script>
    
{% endblock %}

Example of cart.twig file:

Payment widgets

For adding payment widgets, such as tamara and tabby

Use template_for_cart_payments_widget :

Last updated

Was this helpful?