Hide price of item in cart on mobile version unless customer is logged-in

Topic summary

A user has implemented code to hide cart prices from non-logged-in customers on desktop, but prices still appear on the mobile version. They’re seeking a solution to extend this functionality to mobile or implement conditional logic (e.g., “if customer logged in, show price; else show ‘Login’ message”).

Community Response:

  • Multiple users requested the store URL and password (if applicable) to investigate the issue directly.
  • One user provided a technical solution involving three steps:
    1. Locate the price display code in the cart template
    2. Find the specific price segment in the theme code
    3. Wrap the price code with a conditional statement that checks if customers are logged in

Proposed Code:

{%- if shop.customer_accounts_enabled -%}
-- price code --
{%- endif -%}

The discussion remains open, awaiting the original poster’s response with store details or confirmation if the suggested solution resolves the mobile pricing visibility issue.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

I have code in place that requires customers to be logged-in to view prices in their shopping cart but on the mobile version it is still showing item price. Anyone know how to hide it on mobile version or use the code such as “if customer, else

Login

, endif ?

1 Like

Hey @hotrod88

Welcome to Shopify Community! Can you share your Store URL so I can have a look on it? Also, if you have password enabled then please share the password as well. Your cooperation would be greatly appreciated.

Best Regards,
Moeed

Hi @hotrod88 , kindly provide your store URL please and if it is password protected, please share the password as well. Thanks

Hi @hotrod88 ,

Please send the website link, I will check it for you

Hi @hotrod88

We have the solution that can help you with it :

  1. You might need to locate the price code in the cart, you can refer to this link: https://prnt.sc/aWgsKAw4rU4S. 2. Then find the price segment in the theme code; Here is an example of its location : https://prnt.sc/ts0zXOq_KcMn.

  2. Continue to add a conditional code that displays the price only when logged in; if it not logged in, it won’t show. https://prnt.sc/I5JRyz17JOAG

Use this code snippet:

{%- if shop.customer_accounts_enabled -%}
-- price code --
{%- endif -%}

Best regards,

Liz