Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

The Loop Problem

Tyler King edited this page Mar 17, 2020 · 1 revision

If you are using Webhooks to listen for changes, such as a new customer, and then using the API to update this customer, you can create an inadvertent loop. As an example:

  • Your Laravel App listens for a customer update Shopify webhook.
  • Your Laravel App receives this webhook from Shopify and processes it.
  • Your Laravel App then makes a Shopify API call to update this same customer.
  • Shopify then triggers another webhook to your Laravel App as the customer was updated.

And thus an infinite loop is created.

To combat this, it is recommended to implement some mechanism to avoid a loop. For example, don't perform a customer update on the same customer within 60 seconds. The Shopify Dev forums have a number of solutions to this problem but you must implement logic to avoid a loop or you risk hitting API limits, in addition to annoying your App users.