Shopify webhooks not wanted

I am connecting my website to Shopify using the API and Webhooks. When I create a product on my website, I want it to be created on Shopify. That works. But Shopify sends me back a Webhook telling me that a product has been created: So it creates the same product back on my website… I also want product to be created the other way.

I can’t use Shopify product id to check if the product already exists on my website because I haven’t received it yet.

I feel like I might find a way to make it work, but I am not sure it will be the cleanest way. I am wondering what is the best solution for this scenario.

EDIT: (Adding current ideas)

  • The first idea that I have (I think it is a very bad way of doing it, but @Nathan told me to give talk about my ideas :) ), is to unsubscribe from product_create webhook and re-subscribe when I have the ID.
  • The second one, is the make a request based on the product sku. That may work, but it doesn't seems like the strongest solution.

Any chance there is a way to just ask Shopify not to send me back the webhook when I create the product?

EDIT 2: Other idea:

  • Delay the execution of the webhook on my website with a sleep(5) so I have time to same the shopify ID before dealing with the webhook.


You create the new product on your website: Using the api also you create it on your shopify store

POST /admin/products.json
  "product": {
    "title": "Burton Custom Freestlye 151",
    "body_html": "<strong>Good snowboard!<\/strong>",
    "vendor": "Burton",
    "product_type": "Snowboard",
    "images": [
        "src": "http:\/\/\/rails_logo.gif"

shopify response at same time:

"product": {
    "id": 1071559589,
    "title": "Burton Custom Freestlye 151",
    "body_html": "<strong>Good snowboard!<\/strong>",
    "vendor": "Burton",
    "product_type": "Snowboard",
    "created_at": "2015-12-08T11:42:18-05:00",
    "handle": "burton-custom-freestlye-151",
    "updated_at": "2015-12-08T11:42:18-05:00",
    "published_at": "2015-12-08T11:42:18-05:00",
    "template_suffix": null,
    "published_scope": "global",
    "tags": "",
    "variants": [
        "id": 1070325044,
        "product_id": 1071559589,
        "title": "Default Title",
        "price": "0.00",
        "sku": "",
        "position": 1,
        "grams": 0,
        "inventory_policy": "deny",
        "compare_at_price": null,
        "fulfillment_service": "manual",
        "inventory_management": null,
        "option1": "Default Title",
        "option2": null,
        "option3": null,
        "created_at": "2015-12-08T11:42:18-05:00",
        "updated_at": "2015-12-08T11:42:18-05:00",
        "requires_shipping": true,
        "taxable": true,
        "barcode": null,
        "inventory_quantity": 1,
        "old_inventory_quantity": 1,
        "image_id": null,
        "weight": 0.0,
        "weight_unit": "kg"

Then you have the product data created, and you can save the id on a column of your product table website, to validate with the webhook from shopify.

js interview questions