Webhook when a specific product is purchased

jeffgreco
Visitor
2 0 0

Hey everyone.

I'm trying to integrate with a client's custom fulfillment application only for a specific type of "card" that will be offered for purchase through Shopify.

So far I've created the unique product in Shopify, then I setup an Order Payment webhook to fire on every order upon successful payment. My application will then loop through the order line items and detect if the specific product ID is present. If present, it executes the rest of the code.

My question is, can I somehow just trigger a webhook if a specific product is present in the order? Has anyone created something similar and willing to share their method?

Thanks all!

Replies 3 (3)

Gregarican
Shopify Partner
1033 86 285

I'm fairly certain the Shopify webhooks are event driven. If you have subscribed to a specific event type, then the requests are sent for any event that matches of that specific event type. I think as the receiver you are responsible for sending back a response within a certain period of time, and then handling the request data that was sent over. In other words, I think the mechanism isn't granular enough to only send requests for a specific record. It's up to you to parse the requests and only take action based upon the record you are looking for.

jeffgreco
Visitor
2 0 0

That's what I have now and it works fine on order payment. I was just hoping there might be a way to save on requests since I'm really only interested in the 1 product being purchased.

ianwatts
Shopify Partner
3 0 2

Did you ever find a better solution for this or did you just parse the incoming data?