I have a site with many items and variants. alot are out of stock but have variants in stock. How do i stop shopify from showing that. id probably need some code but dont know how to figure that out
example page: https://drawforturn.ca/collections/paldean-fates?sort_by=title-ascending&filter.v.availability=1
Products like : https://drawforturn.ca/products/great-tusk-ex-53-91-paldean-fates?_pos=5&_fid=74e8ff7aa&_ss=c&variant=45054975770860
I only have a NM version in stock and no LP version. but it shows the “from 1.82” on the menu page instead of the version in stock
The theme is refresh
Thanks
Hi @DFTGames ,
May I suggest to update code these steps:
Go to Store Online-> theme → edit code
backup this file snippets/price.liquid to rollback in the case that you don’t want.
Replace code in snippets/price.liquid with code below
{% comment %}
Renders a list of product's price (regular, sale)
Accepts:
- product: {Object} Product Liquid object (optional)
- use_variant: {Boolean} Renders selected or first variant price instead of overall product pricing (optional)
- show_badges: {Boolean} Renders 'Sale' and 'Sold Out' tags if the product matches the condition (optional)
- price_class: {String} Adds a price class to the price element (optional)
- show_compare_at_price: {Boolean} Renders the compare at price if the product matches the condition (optional)
Usage:
{% render 'price', product: product %}
{% endcomment %}
{%- liquid
if use_variant
assign target = product.selected_or_first_available_variant
else
assign target = product
endif
assign compare_at_price = target.compare_at_price
assign price = target.price | default: 1999
assign price_min = product.price_min
assign price_max = product.price_max
assign available = target.available | default: false
for variant in product.variants
if variant.available
if variant.price < price_max or variant.price == price_max
assign price_min = variant.price
endif
endif
endfor
assign money_price = price | money
assign money_price_min = price_min | money
assign money_price_max = price_max | money
if settings.currency_code_enabled
assign money_price = price | money_with_currency
assign money_price_min = price_min | money_with_currency
assign money_price_max = price_max | money_with_currency
endif
if target == product and product.price_varies
assign money_price = 'products.product.price.from_price_html' | t: price: money_price
endif
-%}
{%- comment -%}
Explanation of description list:
- div.price__regular: Displayed when there are no variants on sale
- div.price__sale: Displayed when a variant is a sale
{%- endcomment -%}
{%- if product.quantity_price_breaks_configured? -%}
{%- if show_compare_at_price and compare_at_price -%}
{%- unless product.price_varies == false and product.compare_at_price_varies %}
{{- 'products.product.price.regular_price' | t -}}
<s>
{% if settings.currency_code_enabled %}
{{ compare_at_price | money_with_currency }}
{% else %}
{{ compare_at_price | money }}
{% endif %}
</s>
{%- endunless -%}
{%- endif -%}
{{ 'products.product.price.regular_price' | t }}
{{- 'products.product.volume_pricing.price_range' | t: minimum: money_price_min, maximum: money_price_max -}}
{%- else -%}
{{ 'products.product.price.regular_price' | t }}
{{ money_price }}
{%- endif -%}
{%- unless product.price_varies == false and product.compare_at_price_varies %}
{{ 'products.product.price.regular_price' | t }}
<s>
{% if settings.currency_code_enabled %}
{{ compare_at_price | money_with_currency }}
{% else %}
{{ compare_at_price | money }}
{% endif %}
</s>
{%- endunless -%}
{{ 'products.product.price.sale_price' | t }}
{{ money_price }}
<small>
{{ 'products.product.price.unit_price' | t }}
{{- product.selected_or_first_available_variant.unit_price | money -}}
/
{{ 'accessibility.unit_price_separator' | t }}
{%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%}
{{- product.selected_or_first_available_variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}
</small>
{%- if show_badges -%}
{{ 'products.product.on_sale' | t }}
{{ 'products.product.sold_out' | t }}
{%- endif -%}
Hi thanks for the comment. I replaced the code but nothing seems to have changed.
See page with new code: https://drawforturn.ca/collections/paldean-fates?sort_by=title-ascending&filter.v.availability=1
Hi,
May Could you please update code below?
{% comment %}
Renders a list of product's price (regular, sale)
Accepts:
- product: {Object} Product Liquid object (optional)
- use_variant: {Boolean} Renders selected or first variant price instead of overall product pricing (optional)
- show_badges: {Boolean} Renders 'Sale' and 'Sold Out' tags if the product matches the condition (optional)
- price_class: {String} Adds a price class to the price element (optional)
- show_compare_at_price: {Boolean} Renders the compare at price if the product matches the condition (optional)
Usage:
{% render 'price', product: product %}
{% endcomment %}
{%- liquid
if use_variant
assign target = product.selected_or_first_available_variant
else
assign target = product
endif
assign compare_at_price = target.compare_at_price
assign price = target.price | default: 1999
assign price_min = product.price_min
assign price_max = product.price_max
assign available = target.available | default: false
assign price_min_temp = price_max
for variant in product.variants
if variant.available == true
if variant.price < price_min_temp or variant.price == price_min_temp
assign price_min_temp = variant.price
assign compare_at_price = variant.compare_at_price
endif
endif
endfor
assign price_min = price_min_temp
assign money_price = price | money
assign money_price_min = price_min | money
assign money_price_max = price_max | money
assign money_price_min_no = money_price_min
if settings.currency_code_enabled
assign money_price = price | money_with_currency
assign money_price_min = price_min | money_with_currency
assign money_price_max = price_max | money_with_currency
endif
if target == product and product.price_varies
assign money_price = 'products.product.price.from_price_html' | t: price: money_price
endif
assign money_price_temp = 'products.product.price.from_price_html' | t: price: money_price_min_no
-%}
{%- comment -%}
Explanation of description list:
- div.price__regular: Displayed when there are no variants on sale
- div.price__sale: Displayed when a variant is a sale
{%- endcomment -%}
{%- if product.quantity_price_breaks_configured? -%}
{%- if show_compare_at_price and compare_at_price -%}
{%- unless product.price_varies == false and product.compare_at_price_varies %}
{{- 'products.product.price.regular_price' | t -}}
<s>
{% if settings.currency_code_enabled %}
{{ compare_at_price | money_with_currency }}
{% else %}
{{ compare_at_price | money }}
{% endif %}
</s>
{%- endunless -%}
{%- endif -%}
{{ 'products.product.price.regular_price' | t }}
{{- 'products.product.volume_pricing.price_range' | t: minimum: money_price_min, maximum: money_price_max -}}
{%- else -%}
{{ 'products.product.price.regular_price' | t }}
sss
{{ money_price_temp }}
{%- endif -%}
{%- unless product.price_varies == false and product.compare_at_price_varies %}
{{ 'products.product.price.regular_price' | t }}
<s>
{% if settings.currency_code_enabled %}
{{ compare_at_price | money_with_currency }}
{% else %}
{{ compare_at_price | money }}
{% endif %}
</s>
{%- endunless -%}
{{ 'products.product.price.sale_price' | t }}
{{ money_price_temp }}
<small>
{{ 'products.product.price.unit_price' | t }}
{{- product.selected_or_first_available_variant.unit_price | money -}}
/
{{ 'accessibility.unit_price_separator' | t }}
{%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%}
{{- product.selected_or_first_available_variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}
</small>
{%- if show_badges -%}
{{ 'products.product.on_sale' | t }}
{{ 'products.product.sold_out' | t }}
{%- endif -%}
2 Likes
Awesome thanks this worked great!
Hi Sorry there was an issue with it. I have since disabled it from my store but it would show on collection pages
“sss - then the available price” instead of “prices from the avaialbe price” and on product pages would say “sss- the lowest price” and would not change the price viewed when switching between variant
Hello EBOOST!
I am using shopify inspired theme. How can I add a social share icon? I have added an image. I want to keep the social share icon exactly like this image. Is it possible? Please help me. Thank you.
URL: https://blue-chic-clothes.myshopify.com/products/sexy-women-one-shoulder-long-sleeve-jumpsuit
Password: Admin
Now
I want
Hi,
If you want to disable on Product detail page. I suggest code below:
{% comment %}
Renders a list of product's price (regular, sale)
Accepts:
- product: {Object} Product Liquid object (optional)
- use_variant: {Boolean} Renders selected or first variant price instead of overall product pricing (optional)
- show_badges: {Boolean} Renders 'Sale' and 'Sold Out' tags if the product matches the condition (optional)
- price_class: {String} Adds a price class to the price element (optional)
- show_compare_at_price: {Boolean} Renders the compare at price if the product matches the condition (optional)
Usage:
{% render 'price', product: product %}
{% endcomment %}
{%- liquid
if use_variant
assign target = product.selected_or_first_available_variant
else
assign target = product
endif
assign compare_at_price = target.compare_at_price
assign price = target.price | default: 1999
assign price_min = product.price_min
assign price_max = product.price_max
assign available = target.available | default: false
unless template == 'product' or section.id contains 'featured_product'
assign price_min_temp = price_max
assign compare_at_price_temp = compare_at_price
for variant in product.variants
if variant.available == true
if variant.price < price_min_temp or variant.price == price_min_temp
assign price_min_temp = variant.price
assign compare_at_price_temp = variant.compare_at_price
endif
endif
endfor
endunless
assign money_price = price | money
assign money_price_min = price_min | money
assign money_price_max = price_max | money
assign money_price_min_no = price_min_temp | money
assign money_price_temp = price_min_temp | money
if settings.currency_code_enabled
assign money_price = price | money_with_currency
assign money_price_min = price_min | money_with_currency
assign money_price_max = price_max | money_with_currency
endif
if target == product and product.price_varies
assign money_price = 'products.product.price.from_price_html' | t: price: money_price
assign money_price_temp = 'products.product.price.from_price_html' | t: price: money_price_min_no
endif
-%}
{%- comment -%}
Explanation of description list:
- div.price__regular: Displayed when there are no variants on sale
- div.price__sale: Displayed when a variant is a sale
{%- endcomment -%}
{%- if product.quantity_price_breaks_configured? -%}
{%- if show_compare_at_price and compare_at_price -%}
{%- unless product.price_varies == false and product.compare_at_price_varies %}
{{- 'products.product.price.regular_price' | t -}}
<s>
{% if settings.currency_code_enabled %}
{{ compare_at_price | money_with_currency }}
{% else %}
{{ compare_at_price | money }}
{% endif %}
</s>
{%- endunless -%}
{%- endif -%}
{{ 'products.product.price.regular_price' | t }}
{{- 'products.product.volume_pricing.price_range' | t: minimum: money_price_min, maximum: money_price_max -}}
{%- else -%}
{{ 'products.product.price.regular_price' | t }}
{% unless template == 'product' or section.id contains 'featured_product' %}
{{ money_price_temp }}
{% else %}
{{ money_price }}
{% endunless %}
{%- endif -%}
{%- unless product.price_varies == false and product.compare_at_price_varies %}
{{ 'products.product.price.regular_price' | t }}
<s>
{% if settings.currency_code_enabled %}
{{ compare_at_price | money_with_currency }}
{% else %}
{{ compare_at_price | money }}
{% endif %}
</s>
{%- endunless -%}
{{ 'products.product.price.sale_price' | t }}
{% unless template == 'product' or section.id contains 'featured_product' %}
{{ money_price_temp }}
{% else %}
{{ money_price }}
{% endunless %}
<small>
{{ 'products.product.price.unit_price' | t }}
{{- product.selected_or_first_available_variant.unit_price | money -}}
/
{{ 'accessibility.unit_price_separator' | t }}
{%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%}
{{- product.selected_or_first_available_variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}
</small>
{%- if show_badges -%}
{{ 'products.product.on_sale' | t }}
{{ 'products.product.sold_out' | t }}
{%- endif -%}
May I suggest to update code these steps:
Go to Store Online-> theme → edit code
Create “snippets/social-sharing.liquid”
Copy & paste code below
- {% render 'icon-facebook' %}
Share
{{ 'general.social.alt_text.share_on_facebook' | t }}
- {% render 'icon-twitter' %}
Tweet
Tweet
- {% render 'icon-pinterest' %}
Pint it
Pint it
Go to sections/main-product.liquid ( just recommend this section. I don’t know structure of inspired theme. Because this is not free theme) → This one for product detail page
Find “{%- when ‘share’ -%}”
Refer the screenshot to replace code below
{% render 'social-sharing', share_title: product.title, share_permalink: product.url, share_image: product.featured_media %}
Go to sections/featured-product.liquid → for featured product section
Find “{%- when ‘share’ -%}”
Refer the screenshot to replace code below
{% render 'social-sharing', share_title: product.title, share_permalink: product.url, share_image: product.featured_media %}
1 Like
It worked. But if you click on Facebook, the product link is not showing, but the store link is showing. Pinterest icon is OK. Please help me. Thank you so much.
Facebook
Pinterest
EBOOST
May 14, 2024, 4:13am
11
Hi @dreamtechzone_5 ,
Maybe your store has a protect password here. Please remove it.
1 Like
If the theme is live it will be ok? One more thing, Icons can be placed in the center? Thank you very much. I appreciate it.
EBOOST
May 14, 2024, 4:48am
13
If it is ok if is live theme.
You can use code below to adjusted to center
- {% render 'icon-facebook' %}
Share
{{ 'general.social.alt_text.share_on_facebook' | t }}
- {% render 'icon-twitter' %}
Tweet
Tweet
- {% render 'icon-pinterest' %}
Pint it
Pint it
Just update this one
1 Like
It worked. Very helpful. Thank you very much.
Klarna info can be added on product page. Exactly like this image. Is it possible?
EBOOST
May 14, 2024, 5:04am
15
1 Like
Oh Great. Thank you very much.