Shopify - Create Customer button

I just want to set up a “Create Customer” button using Shopify pack.
I expect it to be like a form where I can enter new customer’s basic information such as name, email, phone, tags …etc and add a new customer to my Shopify by hitting “Create Customer” button.

I couldn’t figure out how to do it and wasn’t able to find a solution by looking at the Sample Shopify starter template.

Any kind of suggestions or help will be appreciated :pray: Thanks!!!

Hey @Yoshiaki_Hayashi,
there are probably several ways to do that, but basically, when you have the Shopify pack set up, every Button can be a “Create Customer in Shopify” Button. I think the normal “Form”-Feature is mostly here to put data into a table, but we can use a table itself to work like a form and create customers:

1. Create a table with the fields you want to fill out. E.g.:
Bildschirmfoto 2021-05-06 um 18.15.44

2. Now add a column “Button”, and in the action, scroll down to Shopify and select “Create customer”.
After you have selected the action, you can choose the fields you want to populate by clicking on add more. In the field, select the respective column by entering e.g. “=Email”.

3. Now you can test it. You should be able to fill out the row and click on create customer. The button click takes about 1-3 seconds but in my tests it took about 1-3 additional seconds until it made sense to refresh my customer table. Refreshinig my customer table after about 5 seconds showed me the new customer, pulled from Shopify back to Coda.

So hopefully this already works, but I’d recommend making this just a helper button and adding another button, that triggers this one – but also hides or deletes the just created row or does some validation before creating the customer.

4. To do that, I created a second button. In the action, I added a Formula that triggers my Shopify Create button - and after that deletes the row.

    RunActions(
      thisRow.[Shopify-Create],
      thisRow.DeleteRows()
    )

Bildschirmfoto 2021-05-06 um 18.25.52

Cleanup and additional thoughts:
In the end you can hide the “Shoppify-Create” Helper button and you should be good to go with this little table-form. With validation, you could already check in the Create Button, if the email exists, if the fields are populates and so on. A simple way is to just use the “disabled if” field in the button.

If you want to dive deeper into custom made forms, validation and more, I can absolutely recommend @Paul_Danyliuk s Video Series here Best Practices Showcase (8 hours of videos & a doc).

Let me know if it works and fulfills your need :slight_smile:

1 Like