Hi everyone. I’ve tried seeking professional help but they are unable to resolve (other than proposing to remove the labels without checking the root). Hence, would like to try out the community here. 2 Issues:
As the title suggests, I need help to debug 2 issues:
[1] My products are all showing as “Sold Out” in public view, but when I’m customizing on Kalles theme, it doesn’t says sold out. I have remapped all my products/ ensure inventory are not 0. But no matter how I’ve tried editing the codes and stuff, the “Sold Out” does not go away. I still want it to show only when all variant of the inventory hits zero. Products on DSers have been checked. Prices have been reset too. Inventory confirm available.
[2] Remove -x% discount label. After i compared product prices and discounted price of my products, there is a -6% label appearing on my product; homepage & individual product page. I’ve managed to hide it using a custom css on the homepage:
(.nt_label.onsale,
.onsale {
display: none !important;
}
However, the discount label is still visible in the individual product page, together with the mysterious “Sold Out” label.
I’m wondering if there’s any professionals here who can guide me on this, please.
For [2], I have the following code:
{%- comment -%}badge_Sale product.created_at product.published_at{%- endcomment-%} {%- liquid if settings.use_new_label assign nowTimestamp = ‘now’ | date: ‘%s’ assign new_day_int = settings.new_day | default: 10 endif assign pr_tags = product.tags | downcase assign prTags = product.tags | join:‘,’ assign hd_up = ‘group-’ |append:product.id assign ck_sale_first = false assign on_sale = false unless pr_tags contains ‘notsale’ if settings.use_sale_label and linklists[hd_up].links.size == 0 and product.compare_at_price > product.price assign ck_sale_first = true assign lb_sale_style = settings.label_sale_style assign pr_variants = product.variants if on == ‘singe’ assign current_variant = product.selected_or_first_available_variant elsif pr_variants.first.compare_at_price > pr_variants.first.price assign current_variant = pr_variants.first else assign current_variant = pr_variants.last endif assign compare_price = current_variant.compare_at_price assign product_price = current_variant.price if compare_price > product_price assign on_sale = true endif endif endunless assign sold_out = true if product.available or settings.use_sold_out_label == false assign sold_out = false endif assign new_label = false unless settings.use_new_label == false or pr_tags contains “notnew” assign dateStart = product.created_at | date: ‘%s’ assign diffSeconds = nowTimestamp | minus: dateStart assign diffDays = diffSeconds | divided_by: 3600 | divided_by: 24 if diffDays <= new_day_int assign new_label = true endif endunless assign badgetags = product.tags | where: "badge" -%} {%- if ck_sale_first -%} {%- if lb_sale_style == ‘1’ -%}<span class=“nt_label onsale”{% if on_sale == false and on == ‘singe’ %} style=“display:none”{% endif %}>{{ ‘products.product.on_sale’ | t }}{%- elsif lb_sale_style == ‘2’ %}{% if on_sale %}{% assign save = compare_price | minus: product_price | times: 100.0 | divided_by: compare_price | ceil %}{% endif %}<span class=“onsale nt_label”{% unless on_sale %} style=“display:none”{% endunless %}>{{ ‘products.product.save_js’ | t: saved_amount:save }}{%- endif -%} {%- endif -%} {%- if new_label -%}{{ ‘products.product.new’ | t }}{%- endif -%} {%- if badge_tags.size > 0 -%} {%- for tag in badgetags limit:3 -%}{%- assign badgeTag = tag | remove: "badge" -%}{%- assign badgeTagHandle = badgeTag | handle -%}{{ badgeTag | capitalize}}{%- endfor -%} {%- endif -%} {%- if sold_out -%}{{ ‘products.product.sold_out’ | t }}{%- endif -%}
However, Claude AI guided me with the following code:
assign sold_out = true
if product.available or settings.use_sold_out_label == false assign sold_out = false
endif
The issue is that your product.available is showing as false (from the debug), so sold_out stays true.
It provided a new code:
assign sold_out = false
if settings.use_sold_out_label and pr_tags contains ‘soldout’
assign sold_out = true
endif
It’s still broken. “Sold Out” is still visible.
Help please. I’m not too sure which is this categorized under too. Thank you.
