Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: retrieving the customer note

How can I retrieve a customer's note in my website's registration data?

praveen995
Shopify Partner
5 0 0

I am using the following snipper to get the custom data of customer upon new registration to my website

 

  <label for="customer_vat_reg_no" class="col-lg-3 col-md-3 col-form-label">GST Number</label>
              <div class="col-lg-6 col-md-6">
<input id="customer_vat_reg_no" type="text" name="customer[note][GST Number]" placeholder="GST Number" autocorrect="off" autocapitalize="words" autofocus>
              </div>

 

 I can see the information on the customer account details page on my Shopify dashboard.

praveen995_0-1681130286735.png

I tried retrieving the data with the following code, but the data is not showing up. 

 

{% if customer %}
      <p>{{ customer.note }}</p>
      {% endif %}

 

 

 

 

Replies 2 (2)

oliversinz
Shopify Partner
96 7 18

Hi @praveen995 

Hope you're having a great day!

The customer note isn't accessible through Liquid, but can be accessed through the Customer object of the Admin API.

 

Here's an example via GraphQL ADMIN API:

Deluxyys-·-Shopify-GraphiQL-App-·-Shopify.png

 

- Was my reply helpful then Click Like and Mark it as an Accepted Solution

- Feel free to contact me regarding any help on: Twitter | LinkedIn | My website



- Want to modify or custom changes on store Hire me.
Shopify Partner | Full Stack Software Developer
praveen995
Shopify Partner
5 0 0

Hi I tried as per the idea above, i am continuously getting the following error

 

 

{
    "errors": "[API] Invalid API key or access token (unrecognized login or wrong password)"
}

 

 

I used the following rest api 

 

 

https://xxxx.myshopify.com/admin/api/2021-07/orders/{order_id}.json?fields=customer&X-Shopify-Access-Token=...abcd1234....