Shopify Tips

Hide Prices for Non Logged-In Visitors

Hide Prices for Non Logged-In Visitors

Objective:

Control who sees your product prices by hiding price information for non-logged-in site visitors.

Benefit:

Hide product prices and limit the option to 'add to cart’ for site visitors who have not logged in to your store. This feature allows you to manage pricing visibility either globally or regionally. While logged-in users can see prices and add products to their cart, non-registered visitors cannot see prices or purchase products until they create an account on your store.

How to Hide Prices for Non Logged-In Visitors:

Step 1: Access Your Shopify Admin

Log in to your Shopify admin panel. From the home screen, navigate to Online Store and then click Themes.

Step 2: Edit Code

In the Themes section, find the theme you're using and click Actions, then select Edit code from the dropdown menu. This action will open the theme's code editor.

Step 3: Add Liquid Code to Hide Prices

In the code editor, locate the product template file (product.liquid) and the collection template file (collection.liquid). Modify these files to conditionally hide prices and 'add to cart' buttons for non-logged-in visitors.

Modify product.liquid:
Modify collection.liquid:

Step 4: Add Schema for Customization

In the config/settings_schema.json file, add the following settings to allow customization of the login message text:

Step 5: Update HTML with Customizable Text

Modify the HTML code to use the customizable text from the schema settings. Update product.liquid and collection.liquid:

Step 6: Save Your Changes

Once you have made all the changes, click the Save button at the top right of the code editor.

Step 7: Verify the Functionality

Test your store as both a logged-in and a non-logged-in user to ensure that the prices and 'add to cart' buttons are hidden correctly for non-logged-in visitors.

Conclusion

Hiding prices for non-logged-in visitors helps you control pricing visibility and can encourage visitors to create an account on your store. This feature improves user engagement and ensures that only registered users have access to product pricing and purchasing options.

Previous
Hide 'Add To Cart' Button And Add 'Contact For Price'
Next
Functionality Store Review