cart Function
Provides the data for the current session’s shopping cart. For example output, see cart Resource.
Note that templates that access the cart resource cannot be cached. It is recommended to load cart data asynchronously
Refer to this guide on how to load uncacheable resources with the template API.
{% set cart = cart() %}
{% if cart.created %}
{{ cart.id }}
{% endif %}