Cart interactions
Add, update, and remove items from a customer's cart.
Customers interact with their cart using Easol's built-in form tags.
These tags can be used within templates and blocks to add, update, or remove items from the cart without implementing your own cart logic.
This section covers:
Redirecting after form submission
By default, submitting a cart form reloads the current page.
To redirect the customer to another page after the form has been submitted, pass a return_to parameter to the form tag.
For example:
{% form "clear_cart", return_to: "/home" %}
<input type="submit" value="Clear cart" />
{% endform %}You can also pass the destination as a Liquid variable:
{% assign return_url = "/my-page" %}
{% form "clear_cart", return_to: return_url %}
<input type="submit" value="Clear cart" />
{% endform %}Developer considerations
When implementing cart interactions:
- Use Easol's built-in form tags rather than manually manipulating the cart.
- Use the
return_toparameter to control the customer journey after form submission. - Ensure forms provide clear feedback so customers understand when the cart has been updated.