Join us today @ 1pm EDT for an AMA with 2H Media: Holiday Marketing for Your Shopify Store and have your marketing questions answered by marketing experts 2H Media | Plus watch the 2H Media AMA Livestream on Twitch!

Login to view price with codes (Dawn theme)

Solved

Login to view price with codes (Dawn theme)

catagun
Tourist
4 1 2

Hello everyone,

When I search the forum I saw topics similar to the issue that I mentioned, but all of them are explaining according to older themes of shopify. 

As I mention at the header, I just want members to see the prices of my products. I know that there are apps like login to view price etc. but if it is still easy to achieve that with codes I don't want to pay monthly to an app. 

1) Where should I edit to remove the prices? (I know that I have to edit more than one part)

2) Is this code enough to achieve what I want?

{% if customer %}
<div class="product__price">
{% include 'product-price', variant: current_variant %}
</div>
{% else %}
<b>Our Price:</b> (Dealers Only)
{% endif %}

3) Should I place this code to a spesific line?

Hoping that there is a simple way to achieve that. 

Thank you for your attention.

My site is: (ortodontikmalzeme.com)

Accepted Solution (1)

catagun
Tourist
4 1 2

This is an accepted solution.

I do not know how I did it but I somehow do what I want without any help. I do not know anything about coding so this might not be the best way to accomplish this task. I do not guarantee you for the results. Duplicating your theme before editing might be good move. However I never faced a big problem when I am editing the codes. I didn't delete any codes, I just inserted my codes at the beginning and at the end of the codes.

If you want to check how it is working, visit my site. ortodontikmalzeme.com

 

I used this code:

{% if customer %}

 

 

{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

------------------------------------------------------

For hiding price on most of the pages, edit:

snippets/price.liquid

 

{% if customer %}

whole code is here, just add the code at the beginning and at the end

{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

---------------------------------------------------------

For hiding the prices on the cart items list, edit:

main-cart-items.liquid

{% if customer %}
{%- if item.original_price != item.final_price -%}
<div class="cart-item__discounted-prices">
<span class="visually-hidden">
{{ 'products.product.price.regular_price' | t }}
</span>
<s class="cart-item__old-price product-option">
{{- item.original_price | money -}}
</s>
<span class="visually-hidden">
{{ 'products.product.price.sale_price' | t }}
</span>
<strong class="cart-item__final-price product-option">
{{ item.final_price | money }}
</strong>
</div>
{%- else -%}
<div class="product-option">
{{ item.original_price | money }}
</div>
{%- endif -%}
{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

 

----------------------------------------------

 

{% if customer %}
<div class="cart-item__price-wrapper">
{%- if item.original_line_price != item.final_line_price -%}
<dl class="cart-item__discounted-prices">
<dt class="visually-hidden">
{{ 'products.product.price.regular_price' | t }}
</dt>
<dd>
<s class="cart-item__old-price price price--end">
{{ item.original_line_price | money }}
</s>
</dd>
<dt class="visually-hidden">
{{ 'products.product.price.sale_price' | t }}
</dt>
<dd class="price price--end">
{{ item.final_line_price | money }}
</dd>
</dl>
{%- else -%}
<span class="price price--end">
{{ item.original_line_price | money }}
</span>
{%- endif -%}
{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

 

--------------------------------------------------------------

 

{% if customer %}
<td class="cart-item__totals right medium-hide large-up-hide">
<div class="loading-overlay hidden">
<div class="loading-overlay__spinner">
<svg aria-hidden="true" focusable="false" role="presentation" class="spinner" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
<circle class="path" fill="none" stroke-width="6" cx="33" cy="33" r="30"></circle>
</svg>
</div>
</div>
<div class="cart-item__price-wrapper">
{%- if item.original_line_price != item.final_line_price -%}
<dl class="cart-item__discounted-prices">
<dt class="visually-hidden">
{{ 'products.product.price.regular_price' | t }}
</dt>
<dd>
<s class="cart-item__old-price price price--end">
{{ item.original_line_price | money }}
</s>
</dd>
<dt class="visually-hidden">
{{ 'products.product.price.sale_price' | t }}
</dt>
<dd class="price price--end">
{{ item.final_line_price | money }}
</dd>
</dl>
{%- else -%}
<span class="price price--end">
{{ item.original_line_price | money }}
</span>
{%- endif -%}
{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

 

------------------------------------------

For hiding the price at cart total, edit:

main-cart-footer.liquid

{% if customer %}
<div class="js-contents" {{ block.shopify_attributes }}>

<div class="totals">
<h3 class="totals__subtotal">{{ 'sections.cart.subtotal' | t }}</h3>
<p class="totals__subtotal-value">{{ cart.total_price | money_with_currency }}</p>
{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

View solution in original post

Replies 4 (4)

Zworthkey
Shopify Partner
5581 642 1577

@catagun 

Welcome to Shopify community,
You mean when Someone login then the price is visible.

Let me know if you are looking this,
I have help many of other peoples to achived this.

 

catagun
Tourist
4 1 2

Yes this is exactly what I am talking about.

HavingIssues
Tourist
5 0 3

I also am wanting to implement this to my store, but cant find working code. 

catagun
Tourist
4 1 2

This is an accepted solution.

I do not know how I did it but I somehow do what I want without any help. I do not know anything about coding so this might not be the best way to accomplish this task. I do not guarantee you for the results. Duplicating your theme before editing might be good move. However I never faced a big problem when I am editing the codes. I didn't delete any codes, I just inserted my codes at the beginning and at the end of the codes.

If you want to check how it is working, visit my site. ortodontikmalzeme.com

 

I used this code:

{% if customer %}

 

 

{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

------------------------------------------------------

For hiding price on most of the pages, edit:

snippets/price.liquid

 

{% if customer %}

whole code is here, just add the code at the beginning and at the end

{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

---------------------------------------------------------

For hiding the prices on the cart items list, edit:

main-cart-items.liquid

{% if customer %}
{%- if item.original_price != item.final_price -%}
<div class="cart-item__discounted-prices">
<span class="visually-hidden">
{{ 'products.product.price.regular_price' | t }}
</span>
<s class="cart-item__old-price product-option">
{{- item.original_price | money -}}
</s>
<span class="visually-hidden">
{{ 'products.product.price.sale_price' | t }}
</span>
<strong class="cart-item__final-price product-option">
{{ item.final_price | money }}
</strong>
</div>
{%- else -%}
<div class="product-option">
{{ item.original_price | money }}
</div>
{%- endif -%}
{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

 

----------------------------------------------

 

{% if customer %}
<div class="cart-item__price-wrapper">
{%- if item.original_line_price != item.final_line_price -%}
<dl class="cart-item__discounted-prices">
<dt class="visually-hidden">
{{ 'products.product.price.regular_price' | t }}
</dt>
<dd>
<s class="cart-item__old-price price price--end">
{{ item.original_line_price | money }}
</s>
</dd>
<dt class="visually-hidden">
{{ 'products.product.price.sale_price' | t }}
</dt>
<dd class="price price--end">
{{ item.final_line_price | money }}
</dd>
</dl>
{%- else -%}
<span class="price price--end">
{{ item.original_line_price | money }}
</span>
{%- endif -%}
{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

 

--------------------------------------------------------------

 

{% if customer %}
<td class="cart-item__totals right medium-hide large-up-hide">
<div class="loading-overlay hidden">
<div class="loading-overlay__spinner">
<svg aria-hidden="true" focusable="false" role="presentation" class="spinner" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
<circle class="path" fill="none" stroke-width="6" cx="33" cy="33" r="30"></circle>
</svg>
</div>
</div>
<div class="cart-item__price-wrapper">
{%- if item.original_line_price != item.final_line_price -%}
<dl class="cart-item__discounted-prices">
<dt class="visually-hidden">
{{ 'products.product.price.regular_price' | t }}
</dt>
<dd>
<s class="cart-item__old-price price price--end">
{{ item.original_line_price | money }}
</s>
</dd>
<dt class="visually-hidden">
{{ 'products.product.price.sale_price' | t }}
</dt>
<dd class="price price--end">
{{ item.final_line_price | money }}
</dd>
</dl>
{%- else -%}
<span class="price price--end">
{{ item.original_line_price | money }}
</span>
{%- endif -%}
{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}

 

------------------------------------------

For hiding the price at cart total, edit:

main-cart-footer.liquid

{% if customer %}
<div class="js-contents" {{ block.shopify_attributes }}>

<div class="totals">
<h3 class="totals__subtotal">{{ 'sections.cart.subtotal' | t }}</h3>
<p class="totals__subtotal-value">{{ cart.total_price | money_with_currency }}</p>
{% else %}
YOUR TEXT HERE (LIKE: LOGIN TO VIEW PRICE)
{% endif %}