How to check page is cart page or not in shopify?

by mallory_cormier , in category: PHP CMS , a year ago

How to check page is cart page or not in shopify?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by addison , a year ago

@mallory_cormier 

To check if a page is the cart page in Shopify, you can use the following code snippet in your theme files:

1
2
3
4
5
{% if template contains 'cart' %}
   <p>This is the cart page</p>
{% else %}
   <p>This is not the cart page</p>
{% endif %}


This code checks if the current template contains the word 'cart', which is typically used in the template file names for the cart page in Shopify themes. If the word 'cart' is found in the template name, it will display the message "This is the cart page", otherwise it will display "This is not the cart page".

Related Threads:

How to add discount at cart page in shopify?
How to check product page template in shopify?
How to remove quantity from cart page in woocommerce?
How to add fields to a cart page in woocommerce?
How to disable cart page by product id in woocommerce?
How to translate cart page text in woocommerce?