Using the coupon code from Craft Commerce site I got this code off of Craft Commerce, I had caught an error on the site previously so I'm thinking there might be an error here? I've put it in my file but when I input anything in the form I don't have any response of any kind. I don't get an error message or success message, it just redirects back to the cart and the pricing also remains exactly the same. Thanks!

&lt;form method="POST"&gt;
     &lt;input type="hidden" name="action" value="commerce/cart/updateCart"&gt;
     &lt;input type="hidden" name="redirect" value="store/cart"&gt;
     {{ getCsrfInput() }}
     &lt;span class="{% if cart.getError('couponCode') %}has-error{% endif %}"&gt;
     &lt;input type="text" name="couponCode" class="{% if cart.getError('couponCode') %}has-error{% endif %}" value="{{ cart.couponCode }}" placeholder="{{ "Coupon Code"|t }}"&gt;
     &lt;/span&gt;
     &lt;input type="submit" value="{% if cart.couponCode %}Change{% else %}Apply{% endif %} Coupon"/&gt;
&lt;/form&gt;
I had this problem and the cause was that I was doing this in the base template:

{% set cart = craft.commerce.carts.cart %}


When I should be doing the following:

{% if cart is not defined %}
    {% set cart = craft.commerce.carts.cart %}
{% endif %}


The reason behind is that the cart object in cart.getError function was always being initialized instead of getting the cart from the POST response.