In Craft Commerce, is it possible to show a more meaningful error when the customer tries to add more of a product than is in stock to the cart Currently, if a customer attempts to add a greater quantity of a product to the cart than is in stock, an &quot;Unable to update cart&quot; flash message in shown.  e.g. there are 3 in stock and the customer tries to add 4 to their cart.
Is there any way to change what that error says? As obviously a customer isn't going to know what that means.
Thanks!
If you want to modify the error message, the way to do is not to use the craft.app.session.getFlash('error') value but use the cart.errors instead. Each of the errors has a unique key for specific error then you can add a condition on what message to display. It would something this.
{% if cart.errors|length %}
            &lt;ul&gt;
            {% for attribute, errors in cart.errors %}
               {% if attribute == &quot;lineItems.0.qty&quot; %}
                    {% for key, error in errors %}
                        &lt;li&gt;Product is not available&lt;/li&gt;
                    {% endfor %}
                {% else %}
                    {% for key, error in errors %}
                        &lt;li&gt;{{ attribute }}: {{ error }}&lt;/li&gt;
                    {% endfor %}
                {% endif %}
            {% endfor %}
            &lt;/ul&gt;
{% endif %}

You could also modify the Unable to cart message by adding this to the update cart form
E.g.
{{ hiddenInput('failMessage', 'Error adding cart.'|hash) }}