{% if extraHead is defined %} {{ extraHead }} {% endif %} {% if cart is not defined %} {% set cart = craft.commerce.carts.cart %} {% endif %} {% if showNav is not defined %} {% set showNav = true %} {% endif %}
{% set flashNotice = craft.app.session.getFlash('notice') %} {% if flashNotice %}
{{ flashNotice }}
{% endif %} {% set flashError = craft.app.session.getFlash('error') %} {% if flashError %}
{{ flashError }}
{% endif %} {% if cart.errors|length %}
{% for attribute, errors in cart.errors %} {% if loop.first %}{% endif %} {% endfor %}
{% endif %} {% block body %}
{% block main %}

Default Content

You should not see this.

{% endblock %}
{% endblock %}

Commerce Cart Debug Info

{# The following javascript polls the server every 10 seconds and sees if the cart has changed on another session or browser tab and will refresh the page if the current page is out of date. This prevents the customer from changing the cart on another tab, then submitting an update cart form action that might overwrite the changes on the other page. #} {% js %} function doPoll(){ console.log('Commerce example templates : Polling to see if the order changed on another tab or session'); $.ajax({ url: '', data: { '{{ craft.config.csrfTokenName|e('js') }}': '{{ craft.request.csrfToken|e('js') }}', 'action': 'commerce/cart/get-cart' }, success: function(data) { var orderNumberChanged = (data.cart.number != '{{ cart.number }}'); var orderTotalChanged = (data.cart.totalQty != '{{ cart.totalQty }}'); var orderTotalPriceChanged = (data.cart.totalPrice != '{{ cart.totalPrice }}'); if(orderNumberChanged || orderTotalChanged || orderTotalPriceChanged){ console.log({'orderNumberChanged' : orderNumberChanged, 'orderTotalChanged' : orderTotalChanged, 'orderTotalPriceChanged': orderTotalPriceChanged}); console.log('Reloading the page as the cart has changed'); alert("Your cart has been updated, reloading the page."); location.reload(true); }else{ console.log('Commerce example templates : Nothing changed, checking again in 10 seconds.'); } setTimeout(doPoll,10000); }, dataType: 'json' }); } doPoll(); {% endjs %}