Orders/create webhook payload not including desired fields

Hello,

I’ve scaffolded a barebones shopify app using the shopify cli (shopify app init) which uses the Remix template. I’ve setup some basic webhook functionality which seems to be working… mostly. I have subscribed to the orders/create webhook which I am successfully receiving a payload for, however it seems to not be including all the information.

At first, I had my include_fields in the app.toml omitted, as I read this would result in the webhook providing the full unaltered payload. However, when noticing some information was missing, I added the desired fields yet they still are not being included. Here is the app.toml entry for the orders/create hook:

[[webhooks.subscriptions]]
  topics = [ "orders/create" ]
  uri = "/webhooks"
  include_fields = [
  "shipping_address",
  "shipping_address.name",
  "shipping_address.first_name",
  "shipping_address.last_name",
  "shipping_address.phone",
  "shipping_address.city",
  "shipping_address.zip",
  "shipping_address.address1",
  "shipping_address.address2",
  "shipping_address.company",
  "shipping_address.province",
  "shipping_address.country",
  "shipping_address.province_code",
  "shipping_address.country_code",
  "shipping_lines",
  "line_items"
]

yet the payload still only includes these fields in the shipping_address:

14:01:55 │             remix │ {
14:01:55 │             remix │   shipping_address: {
14:01:55 │             remix │     province: 'Ohio',
14:01:55 │             remix │     country: 'United States',
14:01:55 │             remix │     province_code: 'OH',
14:01:55 │             remix │     country_code: 'US'
14:01:55 │             remix │   },

these are the same 4 fields included when the include_fields was omitted so nothing effectively changed. The include_fields is being read, however, because it’s no longer including the full payload and only shipping_address, shipping_lines, and line_items are being included. Obviously in the documentation Webhooks the shipping address includes many more useful and necessary fields:

"shipping_address": {
    "first_name": "Steve",
    "address1": "123 Shipping Street",
    "phone": "555-555-SHIP",
    "city": "Shippington",
    "zip": "40003",
    "province": "Kentucky",
    "country": "United States",
    "last_name": "Shipper",
    "address2": null,
    "company": "Shipping Company",
    "latitude": null,
    "longitude": null,
    "name": "Steve Shipper",
    "country_code": "US",
    "province_code": "KY"
  },

When I submit my test orders I am using the Bogus payment method, not sure why that would make a difference though as I am still entering the shipping/billing address for the order.

Editing this to say I just manually triggered the orders/create webhook with the shopify app webhook trigger console command and when I did that the payload contained all the expected info, shipping_address was fully filled with name, city, phone, zip etc.

I solved this myself, in the Shopify Partner dashboard, navigate to your app > API Access > Protected Customer Data Access > click ‘Manage’ > under ‘Protected customer fields (optional)’ select Address and select a reason for using it.

1 Like

Hi Paul - glad you figured this out and thanks for coming back to post your solution!