The easiest way would be to just look at the current url - being /cart. Now some themes don't often direct users to that page if they use AJAX carts so you'd need to adapt your approach in that instance.
What's the use case?
Thanks Jason - I'd like to do some checking on my server (via Ajax call) if the user is hitting the cart page... would have preferred to do it on the checkout page, but alas, no javascript is allowed on there from what I've read :)
It's easy to check for the "/cart" url, but as you mentioned, in the case of other implementations of the cart, it may be an issue.
Thanks,
Matt.
Just in case anyone else lands here, you can request the page type. In this case:
{% if request.page_type == 'cart' %}
do something
{% endif %}
https://shopify.dev/docs/themes/liquid/reference/objects/request#request-page_type
User | Count |
---|---|
16 | |
12 | |
7 | |
6 | |
5 |