Re: Price Hide

How can I hide product prices until user account approval?

Naresh_NFD
New Member
8 0 0

Hey,

I would like to hide the price if user is not logged in, i have if else condition but i am facing and issue that anyone have came on our site and randomly logged in with any fake details so i dont want that anyone randomly came and logged in and see the price 
i want that after logged in  there will show wait for approval so our team will verify and get them approval to see the price until they can't see price
Something Exactly I'm looking for you can see in this link
https://www.arte-n.co.uk/products/wooden-bunk-bed-konrad-with-cot-bed?_pos=2&_sid=d14a705b5&_ss=r

Replies 5 (5)

MarinaPetrovic
Shopify Partner
559 124 189

Hi @Naresh_NFD , it's not enough to check if someone is logged in. You should make that if condition with, for example, customer tags. So, when you and your team approve someone, that customer get a specific tag - like 'approved' and then, change your if condition with something like this:

{% if customer.tags contains "approved" %}

 

If this doesn't work, try:

{% for tag in customer.tags %}
 {% if tag == "approved" %}
   //your code
 {% endif %}
{% endfor %}
M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Naresh_NFD
New Member
8 0 0

Thanks @MarinaPetrovic for your answer can you please elaborate more?
https://live4gadgets.com/collections/packing-supplies see this is page 

<div class="product-item__info">
<div class="product-item__info-inner">
{%- capture price_list -%}
{% if customer %}
<div class="product-item__price-list price-list">
{%- if product.price < product.compare_at_price -%}
{%- if product.price_varies -%}
{%- if settings.currency_code_enabled -%}
{%- capture price_min -%}{{ product.price_min | money_with_currency }}{%- endcapture -%}
{%- capture price_max -%}{{ product.price_max | money_with_currency }}{%- endcapture -%}
{%- else -%}
{%- capture price_min -%}{{ product.price_min | money }}{%- endcapture -%}
{%- capture price_max -%}{{ product.price_max | money }}{%- endcapture -%}
{%- endif -%}

<span class="price price--highlight">
<span class="visually-hidden">{{ 'product.general.sale_price' | t }}</span>
{{- 'collection.product.from_price_html' | t: price_min: price_min, price_max: price_max -}}
</span>

<span class="price price--compare">
<span class="visually-hidden">{{ 'product.general.regular_price' | t }}</span>

{%- if settings.currency_code_enabled -%}
{{- product.compare_at_price_min | money_with_currency -}}
{%- else -%}
{{- product.compare_at_price_min | money -}}
{%- endif -%}
</span>
{%- else -%}
<span class="price price--highlight">
<span class="visually-hidden">{{ 'product.general.sale_price' | t }}</span>

{%- if settings.currency_code_enabled -%}
{{- product.price | money_with_currency -}}
{%- else -%}
{{- product.price | money -}}
{%- endif -%}
</span>

<span class="price price--compare">
<span class="visually-hidden">{{ 'product.general.regular_price' | t }}</span>
{%- if settings.currency_code_enabled -%}
{{- product.compare_at_price | money_with_currency -}}
{%- else -%}
{{- product.compare_at_price | money -}}
{%- endif -%}
</span>
{%- endif -%}
{%- elsif product.price_varies -%}
{%- if settings.currency_code_enabled -%}
{%- capture price_min -%}{{ product.price_min | money_with_currency }}{%- endcapture -%}
{%- capture price_max -%}{{ product.price_max | money_with_currency }}{%- endcapture -%}
{%- else -%}
{%- capture price_min -%}{{ product.price_min | money }}{%- endcapture -%}
{%- capture price_max -%}{{ product.price_max | money }}{%- endcapture -%}
{%- endif -%}

<span class="price">
<span class="visually-hidden">{{ 'product.general.sale_price' | t }}</span>
{{- 'collection.product.from_price_html' | t: price_min: price_min, price_max: price_max -}}
</span>
{%- else -%}
<span class="price">
<span class="visually-hidden">{{ 'product.general.sale_price' | t }}</span>
{%- if settings.currency_code_enabled -%}
{{- product.price | money_with_currency -}}
{%- else -%}
{{- product.price | money -}}
{%- endif -%}
</span>
{%- endif -%}
</div>
{% else %}

Login to see price

{% endif %}

{%- if product.selected_or_first_available_variant.unit_price_measurement -%}
<div class="product-item__price-info">
<div class="unit-price-measurement">
<span class="unit-price-measurement__price">{{ product.selected_or_first_available_variant.unit_price | money }}</span>
<span class="unit-price-measurement__separator">/ </span>

{%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%}
<span class="unit-price-measurement__reference-value">{{ product.selected_or_first_available_variant.unit_price_measurement.reference_value }}</span>
{%- endif -%}

<span class="unit-price-measurement__reference-unit">{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}</span>
</div>
</div>
{%- endif -%}
{%- endcapture -%}

{%- capture vendor -%}
{%- if settings.show_vendor -%}
{%- assign vendor_handle = product.vendor | handle -%}
{%- assign collection_for_vendor = collections[vendor_handle] -%}

{%- unless collection_for_vendor.empty? -%}
<a class="product-item__vendor link" href="{{ collection_for_vendor.url }}">{{ product.vendor }}</a>
{%- else -%}
<a class="product-item__vendor link" href="{{ product.vendor | url_for_vendor }}">{{ product.vendor }}</a>
{%- endunless -%}
{%- endif -%}
{%- endcapture -%}

{%- if settings.product_price_position == 'before_title' -%}
{{ price_list }}
{%- endif -%}

{%- if settings.product_price_position == 'after_title' -%}
{{ vendor }}
{%- endif -%}

<a href="{{ filtered_variant.url | default: product.url }}" class="product-item__title text--strong link">{{ product.title }}</a>

{%- if settings.product_price_position == 'before_title' -%}
{{ vendor }}
{%- endif -%}

{%- if settings.show_color_swatch and template != 'blog' -%}
{%- capture color_swatch -%}
{%- capture color_name -%}{{ section.id }}-{{ product.id }}{%- endcapture -%}

{%- for option in product.options_with_values -%}
{%- assign downcased_option = option.name | downcase -%}

{%- if color_label contains downcased_option -%}
{%- assign variant_option = 'option' | append: forloop.index -%}
{%- assign value_to_match = filtered_variant[variant_option] | default: option.selected_value -%}

{%- assign color_swatch_config = settings.color_swatch_config | newline_to_br | split: '<br />' -%}

{%- for value in option.values -%}
{%- assign downcased_value = value | downcase -%}
{%- capture color_id -%}{{ color_name }}-{{ forloop.index }}{%- endcapture -%}

{%- for variant in product.variants -%}
{%- if variant[variant_option] == value -%}
{%- assign variant_for_value = variant -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}

<div class="color-swatch {% if downcased_value == 'white' or downcased_value == 'blanc' %}color-swatch--white{% endif %}">
{%- if variant_for_value.featured_media -%}
{%- capture supported_sizes -%}{%- render 'image-size', sizes: '200,300,400,500,600,700,800', image: variant_for_value.featured_media.preview_image -%}{%- endcapture -%}
{%- assign image_url = variant_for_value.featured_media | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{%- endif -%}

<input class="color-swatch__radio" type="radio" name="{{ color_name }}" id="{{ color_id }}" value="{{ value | escape }}" {% if value_to_match == value %}checked="checked"{% endif %} data-variant-url="{{ variant_for_value.url }}" {% if variant_for_value.featured_media %}data-media-id="{{ variant_for_value.featured_media.id }}" data-image-url="{{ image_url }}" data-image-widths="[{{ supported_sizes }}]" data-image-aspect-ratio="{{ variant_for_value.featured_media.preview_image.aspect_ratio }}"{% endif %} aria-label="{{ value | escape }}">
<label class="color-swatch__item" for="{{ color_id }}" style="{% render 'color-swatch-style', color_swatch_config: color_swatch_config, value: downcased_value %}" title="{{ value | escape }}">
<span class="visually-hidden">{{ value }}</span>
</label>
<a href="{{ product.url }}" class="color-swatch__item-link">+{{ option.values.size | minus: forloop.index0 }}</a>
</div>
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- endcapture -%}

{%- if color_swatch != blank -%}
<div class="product-item__swatch-list">
<div class="color-swatch-list">
{{ color_swatch }}
</div>
</div>
{%- endif -%}
{%- endif -%}

{%- if settings.product_price_position == 'after_title' -%}
{{ price_list }}
{%- endif -%}

{%- if settings.show_reviews_badge -%}
<a class="product-item__reviews-badge link" href="{{ product.url }}#product-reviews">
{%- render 'product-rating', product: product -%}
</a>
{%- endif -%}

{%- if settings.show_inventory_quantity and product.variants.first.inventory_management != blank and product.template_suffix != 'pre-order' -%}
{%- if product.available -%}
{%- assign should_calculate_inventory = true -%}

{%- for variant in product.variants -%}
{%- comment -%}
If we have one variant that is set to "continue" or that do not have any inventory management, then we skip the calculation of inventory as this
means at least one of the variant is always purchasable
{%- endcomment -%}

{%- if variant.inventory_policy == 'continue' or variant.inventory_management == null -%}
{%- assign should_calculate_inventory = false -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}

{%- if should_calculate_inventory and settings.low_inventory_threshold > 0 -%}
{%- assign all_inventory = 0 -%}

{%- for variant in product.variants -%}
{%- if variant.inventory_management -%}
{%- assign all_inventory = variant.inventory_quantity | at_least: 0 | plus: all_inventory -%}
{%- endif -%}
{%- endfor -%}

{%- if all_inventory <= settings.low_inventory_threshold -%}
<span class="product-item__inventory inventory inventory--low">{{ 'collection.product.low_stock_with_quantity_count' | t: count: all_inventory }}</span>
{%- else -%}
<span class="product-item__inventory inventory inventory--high">{{ 'collection.product.in_stock_with_quantity_count' | t: count: all_inventory }}</span>
{%- endif -%}
{%- else -%}
{%- if product.variants.first.inventory_policy == 'continue' and product.variants.first.inventory_quantity <= 0 and product.variants.first.requires_shipping -%}
<span class="product-item__inventory inventory inventory--high">{{ 'collection.product.oversell_stock' | t }}</span>
{%- else -%}
<span class="product-item__inventory inventory inventory--high">{{ 'collection.product.in_stock' | t }}</span>
{%- endif -%}
{%- endif -%}
{%- else -%}
<span class="product-item__inventory inventory">{{ 'collection.product.sold_out' | t }}</span>
{%- endif -%}
{%- endif -%}
</div>

{%- if request.page_type == 'collection' or request.page_type == 'search' or show_add_to_cart -%}
{%- if section.settings.show_quick_view == 'list_grid' or section.settings.show_quick_buy == 'list_grid' or show_add_to_cart -%}
{%- assign product_form_classes = 'product-item__action-list button-stack' -%}
{%- else -%}
{%- assign product_form_classes = 'product-item__action-list product-item__action-list--list-view-only button-stack' -%}
{%- endif -%}

{%- assign form_id = 'product_form_id_' | append: product.id | append: '_' | append: section.id -%}

{%- if product.template_suffix == 'contact' -%}
<div class="{{ product_form_classes }}">
<a href="mailto:{{ shop.email }}" class="product-item__action-button button button--small button--primary">
{{- 'product.form.contact_us' | t -}}
</a>
</div>
{%- else -%}
{%- form 'product', product, id: form_id, class: product_form_classes -%}
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="id" value="{{ product.selected_or_first_available_variant.id }}">

{%- if section.settings.show_quick_buy == 'list_grid' or show_add_to_cart -%}
{%- assign quick_buy_classes = 'product-item__action-button button button--small button--primary' -%}
{%- else -%}
{%- assign quick_buy_classes = 'product-item__action-button product-item__action-button--list-view-only button button--small button--primary' -%}
{%- endif -%}

{%- if product.available -%}
{%- if product.variants.size == 1 -%}
<button type="submit" class="{{ quick_buy_classes }}" data-action="add-to-cart">
{%- if product.template_suffix == 'pre-order' -%}
{{- 'collection.product.pre_order' | t -}}
{%- else -%}
{{- 'collection.product.add_to_cart' | t -}}
{%- endif -%}
</button>
{%- else -%}
<a href="{{ product.url }}" class="{{ quick_buy_classes }}">{{ 'collection.product.choose_options' | t }}</a>
{%- endif -%}
{%- else -%}
<button class="{{ quick_buy_classes | replace: 'button--primary', 'button--disabled' }}" disabled>{{ 'collection.product.sold_out' | t }}</button>
{%- endif -%}

{%- if section.settings.show_quick_view == 'list_grid' -%}
{%- assign quick_view_classes = 'product-item__action-button button button--small button--ternary hidden-phone' -%}
{%- else -%}
{%- assign quick_view_classes = 'product-item__action-button product-item__action-button--list-view-only button button--small button--ternary hidden-phone' -%}
{%- endif -%}

<button type="button" class="{{ quick_view_classes }}" data-action="open-modal" data-secondary-action="open-quick-view" aria-controls="modal-quick-view-{{ section.id }}" data-product-url="{{ product.url }}">{{ 'collection.product.quick_view' | t }}</button>
{%- endform -%}
{%- endif -%}
{%- endif -%}
</div>


I have placed id customer condition in right place no?
and please visit the page there is no price showing unless you logged in but after login you can see the price but  i dont want that user come and see the price i want that after login there will show one more line "WAIT FOR APPROVAL"
and when i get user info and give them approval so they can see price

 

Naresh_NFD
New Member
8 0 0

@MarinaPetrovic How do we give approve tag to user?

 

MarinaPetrovic
Shopify Partner
559 124 189

Hi @Naresh_NFD , you should add tags to approved customers in your admin panel. 
Here:
Screenshot 2023-01-30 at 21.05.25.png

M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

oscprofessional
Shopify Partner
16115 2409 3123

@Naresh_NFD ,

You can use this App.

https://apps.shopify.com/login-to-see-price-b2b?st_source=autocomplete

 

May be this will work..

Otherwise, you need to go for customization for your login form. 

 

 

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: [email protected] | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free