How to Prefill customer address or email on the checkout page

willryanuk
Shopify Partner
3 0 0

I can make it work using checkout permalinks as detailed here:
https://community.shopify.com/c/shopify-design/cart-use-permalinks-to-pre-load-the-cart/td-p/613702

 

But it doesn't seem possible to do the same by putting in a form input on my cart page such as:

 

 

<input type="text" name="checkout[shipping_address][zip]" value="SW17 8AL">

 

 

 

Other inputs for order attributes pass through to the order just fine:

 

 

<input type="text" class="datepicker__input" name="attributes[deliveryDate]" id="datepicker__input">

 

 

 

or

 

 

<textarea name="attributes[gift-note]" id="GiftNote"></textarea>

 

 

 

I've also tried to do it via the the post URL of my form but this doesn't work either:

 

 

<form action="/cart?checkout[shipping_address][zip]=SW178AL" method="post" novalidate class="cart">

 

 



I'd prefer not to go via the API (or build up a permalink URL based on what the user inputs into my attribute fields on my cart page), I want to achieve this using pure HTML/javascript. But from what I can see, it isn't possible. Any ideas?

Replies 6 (6)

Illia_Kuzma
Shopify Partner
36 2 14

Hey,

I am not sure if that's what you are looking for. This will probably work for Shopify Plus ONLY.

If you have layout/checkout.liquid you can execute js on a checkout page.

I just save checkout form data as cookie and then fill form fields with that.

willryanuk
Shopify Partner
3 0 0

Unfortunately we're on Advanced Shopify, not on Shopify Plus, otherwise this would be a good solution.

Illia_Kuzma
Shopify Partner
36 2 14
Dan_Katorza
Tourist
5 0 4

Hi,
Were you able to find a solution? 
Thanks

Illia_Kuzma
Shopify Partner
36 2 14

I was. But we are on Shopify Plus

willryanuk
Shopify Partner
3 0 0

No simple solution was found for Advanced Shopify. I didn't try via the API (I needed to do it using some sort of HTTP POST or deep link, but nothing seemed to work).