Hide inventory quantities until logged in

Solved

Hide inventory quantities until logged in

Maxfield
Tourist
5 0 0

Hello,

 

Is there a way hide inventory quantities until the customer logs in?

image.png

 

{% if customer %}

Customer is logged in. Show the product inventory quantities

{% endif %}

 

(Add code to inventory location on product-template.liquid?)

 <div id="inventoryLocationInformation">
              <strong>Inventory:</strong><br />
              <span class="inventoryLocationLoading">Loading..
              </span>
</div>

 

First time on the forum. If I'm not posting in the correct place please let me know.

 

Thank you,

Max

 

 

 

Accepted Solution (1)

JHKCreate
Shopify Partner
3571 638 926

This is an accepted solution.

Hi @Maxfield 

Welcome to the forums!

You're on the right track, where is the code that displays this inventory section? You would just need to wrap it around the first customer condition you wrote.

Did we solve your issue? Like & Mark As Solution to help the community
Should you need any direct help: contact@jhkcreate.com

Learn more about us: jhkcreate.com

View solution in original post

Replies 2 (2)

JHKCreate
Shopify Partner
3571 638 926

This is an accepted solution.

Hi @Maxfield 

Welcome to the forums!

You're on the right track, where is the code that displays this inventory section? You would just need to wrap it around the first customer condition you wrote.

Did we solve your issue? Like & Mark As Solution to help the community
Should you need any direct help: contact@jhkcreate.com

Learn more about us: jhkcreate.com
Maxfield
Tourist
5 0 0

Thanks for the help! Works like a charm!

 

{% if customer %}

<!-- Customer is logged in. Show the product inventory quantities -->

<div id="inventoryLocationInformation">
<strong>Inventory:</strong><br />
<span class="inventoryLocationLoading">Loading..
</span>
</div>

{% endif %}