I am trying to change what my buttons are displaying. Right now the currently are displaying a “SOLD OUT” feature that I cannot seem to reaplce.
I added the code below into the liquid section of the site:
{%- if product.selected_or_first_available_variant.available -%}
{{ ‘products.product.add_to_cart’ | t }}
{%- else -%}
{{ ‘products.product.sold_out’ | t }}
{%- endif -%}
The new section comes up in the editer and it looks like I am able to edit my buttons text, but when I type something new, my button does not change.
How do I get those buttons to say “BUY NOW” instead of “SOLD OUT”
Can you share code for the entire liquid file for the section USP. Also, link to the actual website would be helpful.
Code Below:
{%- assign href = ‘usp-section.css’ | asset_url -%}
{% render ‘link’, href: href %}
{%- if section.settings.product.id != blank -%}
{%- assign product = section.settings.product -%}
{%- endif -%}
{%- assign USPs = section.blocks | where: ‘type’, ‘usp’ -%}
{%- if USPs.size > 0 -%}
{%- for block in USPs -%}
{%- if block.settings.image != blank -%}
{{ block.settings.title }}
{{ block.settings.text | replace: '
', '
' }}
{%- if product.selected_or_first_available_variant.available -%}
{{ 'products.product.add_to_cart' | t }}
{%- else -%}
{{ 'products.product.sold_out' | t }}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{% schema %}
{
“name”: “USP”,
“settings”: [
{
“type”: “header”,
“content”: “Unique Selling Proposition”
}
],
“blocks”: [
{
“name”: “USP”,
“type”: “usp”,
“settings”: [
{
“type”: “image_picker”,
“id”: “image”,
“label”: “Image”
},
{
“type”: “text”,
“id”: “title”,
“label”: “Title”
},
{
“type”: “richtext”,
“id”: “text”,
“label”: “Text”
},
{
“type”: “header”,
“content”: “Button”
},
{
“type”: “text”,
“id”: “button_text”,
“label”: “Text”
},
{
“type”: “url”,
“id”: “button_url”,
“label”: “Link”
},
{
“type”: “product”,
“id”: “product”,
“label”: “Product”
}
]
}
]
}
{% endschema %}
Hi @GildedSocial Try this one
{%- assign href = 'usp-section.css' | asset_url -%}
{% render 'link', href: href %}
{%- if section.settings.product.id != blank -%}
{%- assign product = section.settings.product -%}
{%- endif -%}
{%- assign USPs = section.blocks | where: 'type', 'usp' -%}
{%- if USPs.size > 0 -%}
{%- endif -%}
{% schema %}
{
"name": "USP",
"settings": [
{
"type": "header",
"content": "Unique Selling Proposition"
}
],
"blocks": [
{
"name": "USP",
"type": "usp",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "Image"
},
{
"type": "text",
"id": "title",
"label": "Title"
},
{
"type": "richtext",
"id": "text",
"label": "Text"
},
{
"type": "header",
"content": "Button"
},
{
"type": "text",
"id": "button_text",
"label": "Text"
},
{
"type": "url",
"id": "button_url",
"label": "Link"
},
{
"type": "product",
"id": "product",
"label": "Product"
}
]
}
]
}
{% endschema %}