Hide and show SKU number and inventory level based on customer tag

Solved
Highlighted
Tourist
7 0 2

Hi, 

any solutions on how to show the product SKU number and stock availability only for customers tagged with "wholesale"?

 

Thanks,

Axel

0 Likes
Highlighted
Astronaut
1088 181 215

Hello,

It would require 
Liquid/CSS/Javascript knowledge to implement this feature, I'm afraid that unfortunately there is no simple copy-paste solution otherwise I'd happily guide you through.

In case you're unfamiliar with these technologies you'll likely want to hire a Shopify developer to assist you.

If it is of your wish, feel free to send me an e-mail.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
Shopify Partner
2427 526 672

Hey @localelectro,

You can do like this.

{% if customer.tags contains 'wholesale' %}
display product SKU code here..
display stock code here...
{% endif %}

 

Hope this works for you and feel free to contact me if need any help.

Thanks! 

If helpful then please Like and Accept Solution.
Do you need custom changes on store ? Hire me.
Feel free to Contact me on dmw.webartisan@gmail.com
Follow us on Instagram @dmw.webartisan
0 Likes
Highlighted
Tourist
7 0 2

Thanks!

 

but I don’t want to hard code the SKU and stock levels. How can this info be fetched dynamically for each product?

 

 Thanks,

Axel

1 Like
Highlighted
Shopify Partner
2427 526 672

This is an accepted solution.

Hey @localelectro,

I understand. I just have given you an example but if you want it more dynamic then please refer following URLs.

For stock

http://docs.minionmade.com/shopify/show-inventory-quantities-on-product-pages-in-shopify

 

For SKU

https://shopify.github.io/liquid-code-examples/example/show-product-sku

 

Hope this helps you. This is a bit customization work. If you are enabled to do it then I would suggest hiring a Shopify expert or feel free to contact me.

 

Cheers!

 

If helpful then please Like and Accept Solution.
Do you need custom changes on store ? Hire me.
Feel free to Contact me on dmw.webartisan@gmail.com
Follow us on Instagram @dmw.webartisan
1 Like
Highlighted
Tourist
7 0 2

Thanks, that did the job!

 

Is it also possible to hide the top "Announcement bar" for customers tagged?

 

localelectro_0-1598260138343.png

 

 

 

1 Like
Highlighted
Shopify Partner
2427 526 672

Hey @localelectro,

Please try to use the same condition for announcement bar as well. If any problem let me know.

Thanks!

If helpful then please Like and Accept Solution.
Do you need custom changes on store ? Hire me.
Feel free to Contact me on dmw.webartisan@gmail.com
Follow us on Instagram @dmw.webartisan
1 Like
Highlighted
Tourist
7 0 2

OK cool, how would that be inserted in the liquid-file that looks like this?

 

 

{%- if section.settings.enable_bar -%}
{%- unless section.settings.home_page_only and template != 'index' -%}
<section id="section-{{ section.id }}" data-section-id="{{ section.id }}" data-section-type="announcement-bar">
<div class="AnnouncementBar">
<div class="AnnouncementBar__Wrapper">
<p class="AnnouncementBar__Content Heading">
{%- if section.settings.link -%}
<a href="{{ section.settings.link }}">{{ section.settings.content | escape }}</a>
{%- else -%}
{{ section.settings.content | escape }}
{%- endif -%}
</p>
</div>
</div>
</section>

<style>
#section-{{ section.id }} {
background: {{ section.settings.background }};
color: {{ section.settings.text_color }};
}
</style>

<script>
document.documentElement.style.setProperty('--announcement-bar-height', document.getElementById('shopify-section-announcement').offsetHeight + 'px');
</script>
{%- endunless -%}
{%- endif -%}

{% schema %}
{
"name": "Announcement bar",
"settings": [
{
"type": "checkbox",
"id": "enable_bar",
"label": "Enable bar",
"default": true
},
{
"type": "checkbox",
"id": "home_page_only",
"label": "Home page only",
"default": false
},
{
"type": "color",
"id": "background",
"label": "Background",
"default": "#000000"
},
{
"type": "color",
"id": "text_color",
"label": "Text",
"default": "#ffffff"
},
{
"type": "text",
"id": "content",
"label": "Text",
"default": "Announce something here"
},
{
"type": "url",
"id": "link",
"label": "Link"
}
]
}
{% endschema %}

0 Likes