All things Shopify and commerce
Hello all,
I have created a private collection where the products in this collection are only meant for wholesalers and only when they are logged in they can see the collection and all the products in them via code.
But at the same time, I am able to enter the exact product page via direct product URL without having to go through the collections page or the protected collection and it will be visible to anyone
For example : store-name.com/products/product-name
Is there anyway to restrict a direct URL access to these products via code?
{% if customer %}
{% if collection.title == 'Your Collection Name' %}
<p>This content will be displayed for logged-in customers in the 'Your Collection Name' collection.</p>
{% else %}
<p>This content will be displayed for logged-in customers not in the 'Your Collection Name' collection.</p>
{% endif %}
{% else %}
<p>This content will be displayed for visitors (not logged in).</p>
{% endif %}
Hi ProtoMan44,
Where do I paste this code? Sorry I am not very good with the coding but I am able to learn fast.
Just to also check does this code only block them from viewing the whole collection or they will not be able to use direct URL anymore as well?
Because I already made it so that they are not able to access the collection if they are not logged in.
But for e.g if someone who has access to that collection , can access the direct product url of that page and give it to someone without access to the collection, they can still check out that product in their cart.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024