Shopify themes, liquid, logos, and UX
I've been looking but can't find my answer.
Here is my code. Using this code I can get the checkout button on the /cart page to show "Checkout test" for VIP customers and the standard "Checkout" for everyone else. (even though it looks reversed to me, it works !!??).
{% if customer.tags != 'VIP' %}
<input type="hidden" name="attributes[collection_products_per_page]" value="">
<input type="hidden" name="attributes[collection_layout]" value="">
<button type="submit" name="checkout" class="cart-recap__checkout button button--primary button--full button--large">{{ 'cart.general.checkout' | t }} test</button>
{% else %}
<input type="hidden" name="attributes[collection_products_per_page]" value="">
<input type="hidden" name="attributes[collection_layout]" value="">
<button type="submit" name="checkout" class="cart-recap__checkout button button--primary button--full button--large">{{ 'cart.general.checkout' | t }} </button>
{%- endif -%}
What I want to do is to have a translation specifically for the VIP customers, so it says "Quote Request" as these customers do not have a payment gateway (that bits all working fine). How do I add a custom translation or apply inline "Quote Request" text to:
{{ 'cart.general.checkout' | t }}
All help appreciated.
Hi @JustinW1
Hope you're having a great day!
You should use contains operator. contains checks for the presence of a substring in a string.
So:
{% if customer.tags contains "VIP" %}
<input type="hidden" name="attributes[collection_products_per_page]" value="">
<input type="hidden" name="attributes[collection_layout]" value="">
<button type="submit" name="checkout" class="cart-recap__checkout button button--primary button--full button--large">{{ 'cart.general.checkout' | t }} test</button>
{% else %}
<input type="hidden" name="attributes[collection_products_per_page]" value="">
<input type="hidden" name="attributes[collection_layout]" value="">
<button type="submit" name="checkout" class="cart-recap__checkout button button--primary button--full button--large">{{ 'cart.general.checkout' | t }} </button>
{%- endif -%}
If you found this comment useful, hit the 'Like' and 'Accepted solution' buttons.
Thanks @Michal17 super helpful for the identification.
Do you know how I can tackle the second part, and change the button text for these customers?
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024