Ad

Shopify Webhook For Order Fulfillment Firing Callback URL Multiple Times

- 1 answer

I have set the Callback URL in the Order fulfillment webhook.

Now I have put the following code in PHP app:

$webhookContent = "";
$webhook = fopen('php://input', 'rb');
while (!feof($webhook)) {
    $webhookContent. = fread($webhook, 4096);
}
fclose($webhook);

Now when I generate any order and fulfillment it's then the Webhook for Order fulfillment firing Callback URL multiple times, so how to fire for single time?

Ad

Answer

Webhook call is fired multiple times when it doesn't get a success response from the callback URL. You can just try exiting after performing the required functionality. That will be something like:-

$webhookContent = "";
$webhook = fopen('php://input', 'rb');
while (!feof($webhook)) {
    $webhookContent. = fread($webhook, 4096);
}
fclose($webhook);
exit;
Ad
source: stackoverflow.com
Ad