Shopify fulfillments/create and fulfillments/update webhook doesn't providing customer phone number

sachiyablavant
Shopify Partner
29 0 3

I am creating an application for sending messages to customers on various events like order place, order fulfillment, fulfillment cancel, refund, order track and order cancel.

I am using Webhook for it and I am not getting the phone numbers in fulfillment/create and fulfillment/update Webhook.

Kindly make sure that I am getting all data and not only receiving phone numbers.

This is the code sample

<?php
    include("include/connection.php");
    include("variables.php");
    $last_data="SELECT * FROM table_nameORDER BY id DESC LIMIT 1";
    $result = $mysql->query($last_data);
    $row = $result->fetch_assoc();

    $api = "api key";
    $access_token = "access token";
    $webhook_url = "url";
    $webhook_topic = "fulfillments/create";
    $params = array(
        "webhook" => array(
            "topic" => $webhook_topic,
            "address" => $webhook_url,
            "format" => "json"
        ),
    );
    $url = "https://shop_name.myshopify.com/admin/api/2023-01/webhooks.json";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        "X-Shopify-Access-Token: {$access_token}",
        "Content-Type: application/json"
    ));
    curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($params));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($curl);
    curl_close($curl);
?>
Reply 1 (1)

cdarne
Shopify Staff
30 5 14

Hello,

 

Thanks for your question: the phone number in the fulfillment create/update webhooks is part of the protected customer data. In order to access this data, your app needs to request access to this data. You can find all the details here: https://shopify.dev/docs/apps/store/data-protection/protected-customer-data.

 

 

Cheers,

 

Cedric | Developer @ Shopify

To learn more visit the Shopify Help Center or the Community Blog.