Order Webhooks: pass (additional/bundle) product IDs to webhook data

ptoatgrowbix
New Member
3 0 0

Hello,

I'm trying to create a custom feature that allows the user to order a product bundle that is customized. It is basically a knitting webshop. You can pick a pullover and then get instructions + all the yarn you need to knit it yourself. However, you are able to mix up the colors and select different yarn colors than the default ones. I have added select inputs to do this part and then the selection is added to the product in cart/order as product properties. Right now when an order is made I get e.g. Pullover X has been ordered and it has properties - yarn 1: yellow yarn ; yarn 2: red yarn and so on. 
What I'm struggling with is tracking the quantity of the yarn that has been bought along with the pullover. Each type of yarn is a stand-alone product that is also sold in the store.

The plan is to use the order webhook and receive all the order data. There, I can access the properties but they only provide the name of the yarn and nothing more. To go and update the quantity of the yarn using the Admin API I need the product id for the yarn.

I'm not sure how to approach this in a smarter and easier way than fetching all products, looking for a product with a matching name and then extracting the id so that I can write the request that would update the quantity of the yarn.

Do you have any ideas?

ptoatgrowbix_0-1635168781361.png

 

 

Replies 0 (0)