Shopify themes, liquid, logos, and UX
Hello!
How do i hide prices of sold out products on product page for EDITION THEME :)\
Thank u very much!!
@mrjoephua if sold product has unique class or id then using css it can be done, else it will need code editing, can you please share this page link?
Hi @mrjoephua,
Please send me the code of card-product.liquid file, I will check it for you
Hello!, i dont have card-produdct.liquid file. I have product-form-price.liquid
Not sure if it helps 🙂
{% comment %}
@param product {Product}
@param variant {Variant}
@param form {ProductForm}
@param class {String}
{% endcomment %}
<div class="product-details__price-container {{ class }}" {{ block.shopify_attributes }}>
<div class="product-price">
<span class="
product-price__minimum
money
{% if variant.compare_at_price > variant.price %}product-price__minimum--sale{% endif %}
"
data-product-price
>
{% if product != blank %}
{{ variant.price | money }}
{% else %}
{{ 1999 | money }}
{% endif %}
</span>
<s
class="
product-price__compare
money
{% if product.compare_at_price_min <= variant.price %}
product-price__compare--hidden
{% endif %}
"
data-product-price-compare
>
{% if variant.compare_at_price > variant.price %}
{{ variant.compare_at_price | money }}
{% endif %}
</s>
</div>
{% capture total_quantity %}<span data-total-quantity>{{ variant.unit_price_measurement.quantity_value }}{{ variant.unit_price_measurement.quantity_unit }}</span>{% endcapture %}
{% capture unit_price %}<span data-unit-price-amount>{{ variant.unit_price | money }}</span>{% endcapture %}
{% capture unit_measure %}<span data-unit-price-measure>{%- if variant.unit_price_measurement.reference_value != 1 -%}{{ variant.unit_price_measurement.reference_value }}{%- endif %}{{ variant.unit_price_measurement.reference_unit }}</span>{% endcapture %}
<div
class="
product-details__unit-price
accent-text
{% unless variant.unit_price_measurement %}product-details__unit-price--hidden{% endunless %}
"
data-unit-price
>
{{ 'product.unit_pricing.price_per_unit_html' | t: total_quantity: total_quantity, unit_price: unit_price, unit_measure: unit_measure | strip_newlines }}
</div>
{%- capture tax_text -%}
{{ 'product.phrases.tax_line_html' | t }}
{%- endcapture -%}
{%- if tax_text != blank -%}
<div class="
product-details__tax-label
accent-text
{% unless variant.taxable %}product-details__tax-label--hidden{% endunless %}
"
data-tax-line
>
{{ tax_text }}
</div>
{%- endif -%}
<div data-payment-terms-reference style="display: none;">
{{ form | payment_terms }}
</div>
</div>
Hi @mrjoephua,
Please add code here:
Code:
<div class="product-details__price-container {{ class }}" {% if variant.available == false %}style="display: none"{% endif %} {{ block.shopify_attributes }}>
Hello! Thank u! Its hidden from product details page. Would u know also how to hide from product category page?
Thank u so muchhhhh!!!!
Hi @mrjoephua,
Please send me the code of card-product.liquid file, I will check and guide it for you
Hello!, i dont have card-produdct.liquid file. I have product-form-price.liquid
I have product.liquid
{% comment %}
@param product
@param variant
@param enable_zooom
{% endcomment %}
{% assign gallery_block = section.blocks | where: 'type', 'gallery' | first %}
{% assign layout = gallery_block.settings.position | default: 'one-column' %}
{% assign is_quickshop = is_quickshop | default: false %}
{% if is_quickshop and gallery_block != blank %}
{% assign layout = 'two-column' %}
{% endif %}
<div class="product__wrapper product__wrapper--{{ layout }}">
{% if layout == 'two-column' %}
{%
render 'product-gallery',
product: product,
layout: layout,
enable_zoom: enable_zoom,
onboarding: onboarding
block: gallery_block,
%}
{% endif %}
{% if product != blank %}
{% form 'product', product, class: 'product-details', data-product-form: "" %}
{%
render 'product-contents',
product: product,
variant: variant,
form: form,
layout: layout,
section: section,
show_payment_button: show_payment_button,
is_quickshop: is_quickshop,
%}
{% endform %}
{% else %}
<div class="product-details" data-product-form>
{%
render 'product-contents',
section: section,
layout: layout,
onboarding: true,
show_payment_button: show_payment_button,
%}
</div>
{% endif %}
</div>
I also have product-contents.liquid
{% comment %}
@param product {Product}
@param variant {Variant}
@param form {ProductForm}
@param section {Section}
@param layout {String}
One of `one-column` or `two-column`
@param show_payment_button {Boolean}
Renders the DPBs
@param is_quickshop {Boolean}
Link title to product page
{% endcomment %}
{% comment %}Dynamic checkout is not shown if selling plans are available{% endcomment %}
{% if product.selling_plan_groups.size > 0 %}
{% assign show_payment_button = false %}
{% endif %}
{% assign rendered_quantity_selector = false %}
{% assign rendered_variant_selection = false %}
{% assign has_price_and_quantity_block = false %}
{% assign price_and_quantity_block_count = section.blocks | where: 'type', 'price_and_quantity' | size %}
{% if price_and_quantity_block_count > 0 %}
{% assign has_price_and_quantity_block = true %}
{% endif %}
{% assign first_block_class = 'product-block--first' %}
{% for block in section.blocks %}
{% case block.type %}
{% when '@app' %}
<div class="product-details__app" {{ block.shopify_attributes }}>
{% render block %}
</div>
{% when 'title' %}
{% assign heading_element = 'h2' %}
{% if template.name == 'product' %}
{% assign heading_element = 'h1' %}
{% endif %}
<{{ heading_element }}
class="product__heading {{ first_block_class }}"
{{ block.shopify_attributes }}
>
{% if is_quickshop %}<a href="{{ product.url | within: collection }}">{% endif %}
{% if onboarding %}
{{ 'product.onboarding.title' | t }}
{% else %}
{{ product.title }}
{% endif %}
{% if is_quickshop %}</a>{% endif %}
</{{ heading_element }}>
{% when 'vendor' %}
<p
class="
product__vendor
{{ first_block_class }}
"
{{ block.shopify_attributes }}
>
{% if onboarding %}
{{ 'product.onboarding.vendor' | t }}
{% else %}
{{ product.vendor | link_to_vendor }}
{% endif %}
</p>
{% when 'variant_selection' %}
{% if onboarding %}
{% continue %}
{% endif %}
{%
render 'product-options-dropdown',
product: product,
block: block,
class: first_block_class,
%}
{% assign rendered_variant_selection = true %}
{% when 'price' %}
{% if has_price_and_quantity_block %}
{% continue %}
{% endif %}
{%
render 'product-form-price',
product: product,
variant: variant,
form: form,
class: first_block_class,
%}
{% when 'quantity' %}
{% if has_price_and_quantity_block %}
{% continue %}
{% endif %}
{%
render 'product-form-quantity',
class: first_block_class,
%}
{% assign rendered_quantity_selector = true %}
{% when 'price_and_quantity' %}
<div
class="
product-details__qty-price-container
{% if product.options.size > 1 or show_payment_button %}
product-details__qty-price-container--align-columns
{% endif %}
{{ first_block_class }}
"
{{ block.shopify_attributes }}
>
{%
render 'product-form-price',
product: product,
variant: variant,
form: form,
%}
{% render 'product-form-quantity' %}
{% assign rendered_quantity_selector = true %}
</div>
{% when 'text' %}
<div
class="product-details__text"
data-rich-text-area
{{ block.shopify_attributes }}
>
{{ block.settings.text }}
</div>
{% when 'description' %}
{% if product.description != blank or onboarding %}
<div
class="
product-details__description
{{ first_block_class }}
"
data-rich-text-area
{{ block.shopify_attributes }}
>
{% if onboarding %}
{{ 'product.onboarding.description' | t }}
{% else %}
{{ product.description }}
{% endif %}
</div>
{% endif %}
{% when 'form' %}
<div
class="
product-details__add-to-cart-area
{% if product.variants.size == 1 or product.available == false %}
no-variants
{% endif %}
{{ first_block_class }}
"
{{ block.shopify_attributes }}
>
<div
class="
product-details__add-to-cart-buttons
{% if show_payment_button %}
product-details__add-to-cart-buttons--spb-enabled
{% else %}
product-details__add-to-cart-buttons--spb-disabled
{% endif %}
"
>
<button
class="product-details__add-to-cart-button"
type="submit"
data-product-atc
{% unless variant.available %}disabled{% endunless %}
>
<span data-product-atc-text>
{%- if variant.available -%}
{{ 'product.add_to_cart.submit' | t }}
{% else %}
{{ 'product.add_to_cart.sold_out' | t }}
{% endif %}
</span>
<span data-product-atc-loader>
{% render 'icon-library', id: 'icon-spinner' %}
</span>
</button>
{% if show_payment_button %}
{{ form | payment_button }}
{% endif %}
</div>
<div class="
surface-pick-up
{% unless show_payment_button %}
surface-pick-up--spb-disabled
{% endunless %}
"
data-surface-pick-up
></div>
</div>
{% when 'share' %}
<div
class="
product__share
{{ first_block_class }}
"
{{ block.shopify_attributes }}
>
<p class="product__share-text">{{ 'general.social.share_this' | t }}</p>
{% render 'share-buttons', context: product %}
</div>
{% when 'gallery' %}
{% if layout == 'two-column' %}
{% continue %}
{% endif %}
{% capture gallery_classes %}
{{ first_block_class }}
{% if forloop.last %}product-gallery--last{% endif %}
{% endcapture %}
{%
render 'product-gallery',
product: product,
layout: layout,
enable_zoom: enable_zoom,
onboarding: onboarding,
class: gallery_classes,
block: block,
%}
{% when 'rating' %}
{%- if product.metafields.reviews.rating.value != blank -%}
<div class="product__rating rating {{ first_block_class }}" {{ block.shopify_attributes }}>
{%
render 'rating-stars',
value: product.metafields.reviews.rating.value.rating,
scale_max: product.metafields.reviews.rating.value.scale_max,
%}
<p class="rating__text">
<span aria-hidden="true">{{ product.metafields.reviews.rating.value }} / {{ product.metafields.reviews.rating.value.scale_max }}</span>
</p>
<p class="rating__count">
<span aria-hidden="true">({{ product.metafields.reviews.rating_count }})</span>
<span class="visually-hidden">{{ product.metafields.reviews.rating_count }} {{ "general.accessibility.total_reviews" | t }}</span>
</p>
</div>
{%- endif -%}
{% endcase %}
{% assign first_block_class = '' %}
{% endfor %}
{% unless rendered_quantity_selector %}
<input type="hidden" name="quantity" value="1">
{% endunless %}
{% unless rendered_variant_selection %}
<input
name="id"
value="{{ product.selected_or_first_available_variant.id }}"
type="hidden"
>
{% endunless %}
Hi @mrjoephua,
It doesn't seem like these files, can I send you a collaborator invite? it will help me find the file and add code to it
sure!!
Hi @mrjoephua,
Please send me the collaborator code in private message, I will send you the invitation and check it
sent!
Hi @mrjoephua,
Please go to small-product-item.liquid file and add code here:
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024