Login to view price with codes (Dawn theme)

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 %}


{% include ‘product-price’, variant: current_variant %}

{% else %}
Our Price: (Dealers Only)
{% endif %}

  1. 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)

1 Like

@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.

Yes this is exactly what I am talking about.

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 -%}



{{ ‘products.product.price.regular_price’ | t }}


{{- item.original_price | money -}}


{{ ‘products.product.price.sale_price’ | t }}


{{ item.final_price | money }}


{%- else -%}

{{ item.original_price | money }}

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


{% if customer %}


{%- if item.original_line_price != item.final_line_price -%}


{{ ‘products.product.price.regular_price’ | t }}



{{ item.original_line_price | money }}



{{ ‘products.product.price.sale_price’ | t }}


{{ item.final_line_price | money }}


{%- else -%}

{{ item.original_line_price | money }}

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


{% if customer %}









{%- if item.original_line_price != item.final_line_price -%}


{{ ‘products.product.price.regular_price’ | t }}



{{ item.original_line_price | money }}



{{ ‘products.product.price.sale_price’ | t }}


{{ item.final_line_price | money }}


{%- else -%}

{{ item.original_line_price | money }}

{%- 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 }}>


{{ ‘sections.cart.subtotal’ | t }}


{{ cart.total_price | money_with_currency }}


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

1 Like

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