Add Custom Fields to Checkout.Liquid for Shopify PLUS User

Highlighted
Excursionist
37 0 8

I am on a Shopify Plus account.

In my store (not hosted by Shopify) I leverage Buy It Now buttons to fill a cart and then send users to my Shopify Checkout page to complete the transaction.

On my checkout.liquid page (not cart.liquid which I'm not using) I wish to add a "How did you hear about us" dropdown.

A) Is this possible?
B) What are my options for saving the data?  Appending it to the customer record would be bliss.



 

0 Likes
Highlighted
Shopify Expert
10007 116 1822
  1. in theory, yes
  2. order attribute (there's a process to making sure the value carries through to the order)

You won't be appending the data to the customer directly but you could look into using Shopify Flow to add a customer tag based on the attribute.

 

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
Highlighted
Excursionist
37 0 8

Thanks to (shout out) Andrew McGoveran on the Plus Support team for the email that showed me how to accomplish this utterly TRIVIAL task. In the event any other PLUS users wish to accomplish something similar, here's how to do it.

All I did was add the control with HTML, use Javascript to position it where I wanted on the form (appendChild), and then - and this is really the part I needed - for the name attribute of the control set the value to checkout[attributes][YOUR_ID_HERE]. 

So in my case: name=checkout[attributes][Referral]

And boom, if the customers selects a item in the drop down here, it's elegantly displayed on the info page for this order in the Notes box under Additional Details.

And by leveraging the Shopify CSS class and HTML structure, you can even ensure it looks like a native field included by Shopify themselves leaving your customers none the wiser.

Highlighted
Shopify Expert
10007 116 1822

What's important to note is that the field must persist across every step.

If the naming was details you were missing you could have just dropped the question here. Hope you have not been trying to work that out since you first made the post.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted

Thanks for sharing Ryan, it works!

Now just happens that, if I had previous cart attributes saved for that customer/order, they get deleted and replaced by the new attributes set inside the checkout :(

Do you think it's possible to keep both somehow?

0 Likes
Highlighted
New Member
1 0 0

Exactly what I am looking for. Although I need to keep the previous notes from the customers as well. 

0 Likes
Highlighted
Shopify Partner
4 0 0

Ahh mind if I pick your brain about the js?

 

In my case, it's to implement 3 radio  inputs and to save the selected choice. I appended the inputs to the form fine, I can select a choice,   but when i select continue to shipping method it's not appending, does that mean it's not working, or will the selected input choice only be visible for the client under their orders? 

0 Likes
Highlighted
Tourist
3 0 2

I am trying to do the same thing but coudn't get this working. Is this format still work? When I access the checkout page with permalink like ?checkout[shipping_address][first_name]=test, the customer first name field is populated with string test. When I use name=checkout[attributes][Referral] and create an input type text box for it and access the same page with permalink ?checkout[attributes][Referral]=test, the value does not appear in the text box. Please help.

0 Likes
Highlighted
New Member
3 0 0
Use *attributes[Referral]=test* in your permalink instead of *checkout[attributes][Referral]=test*
0 Likes
Highlighted
New Member
1 0 0

Here in Brazil, the invoicing system requires the fields:

  • Address
  • Number
  • Apartment

As in Shopify, the address and the number are in the same field. We can't scale our invoices because we have to fix it order by order manually. 

My checkout.liquid is already activated, but I can't realize where to add this extra field.

I hope someone helps me. Thank you.

0 Likes