Adding a custom alert at checkout

SparkwellRep
New Member
2 0 0

Hi, wanting to know if there's anybody who can help around adding some code to create a custom alert at checkout.

We are launching our business and have our range of products, but they are being shipped from 5 separate vendors and locations, we are UK based and 3 products are coming from inside the UK and 2 are coming from outside of the UK.

 

I want to alert a customer who has put multiple items in their basket, that if they are from separate vendors, their order will arrive separately in two different packages BEFORE they purchase from us.

Is there code I can add to the checkout to bring up this alert before a customer orders from us?

The rules would be:

IF there is products from more than one Product Vendor in the cart, show this message: 'These items are being shipped from different warehouses and will arrive to you in separate packages.'

and

IF items in the basket are from X & Y Product Vendors 'These items are being shipped from Europe and will take 5-10 working days to arrive'

Is there some code I can add to the checkout liquid to flag this message when a customer begins checkout and before they pay? It would be great if the text could show up in the colour #e7816d.

 

Cheers

0 Likes
Ninthony
Shopify Partner
1712 241 657

Are you running a Shopify Plus store? You can only make edits to checkout.liquid if you do. 

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
SparkwellRep
New Member
2 0 0

Not running a Shopify Plus store but using a custom theme

0 Likes
Ninthony
Shopify Partner
1712 241 657

Yeah unfortunately you cannot edit the checkout unless you're on a Shopify Plus store. You can add some conditions to the Additional Scripts section in Settings > Checkout, but those will only appear on the Order Status page which comes after you complete your purchase.

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
PaulNewton
Shopify Partner
2573 135 448

All stores can do this at the CART phase of the checkout flow

Crudely:

{%- assign vendor_mismatch = false -%}
{%- assign vendor_mismatch_message = "Your cart has items from different vendors, restrictions apply" -%}
{%- assign vendor_mismatch_message_text_color = "#e7816d" -%}

{%- assign current_vendor = "" -%}
{%- for item in cart.items -%}
	{%- if current_vendor != item.product.vendor -%}
		{%- assign vendor_mismatch = true -%}
		{%- break -%}
	{%- endif -%}
	{%- assign current_vendor = item.vendor -%}
{%- endfor -%}

{%- if vendor_mismatch -%}
	<p style="color:{{vendor_mismatch_message_text_color }};">{{ vendor_mismatch_message }}</p>
{%- endif -%}

 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com