Hi,
I need some help with webhooks, woocommerce and bubble.
I am attempting to take an order in woocommerce and create a thing (tag) in the bubble database for each item ordered. I have this working with a webhook and two api workflows, but come unstuck when multiples of the same item are ordered.
My wooCommerce webhook looks like this:
"line_items": [
{
"id": 112,
"name": "item 1 - variation 1",
"product_id": 2648,
"variation_id": 2650,
"quantity": 2,
"tax_class": "",
"subtotal": "25.98",
"subtotal_tax": "0.00",
"total": "25.98",
"total_tax": "0.00",
"taxes": [],
"sku": "1"
"parent_name": "tinytag"
},
{
"id": 113,
"name": "item 1 - variation 2",
"product_id": 2648,
"variation_id": 2652,
"quantity": 1,
"tax_class": "",
"subtotal": "12.99",
"subtotal_tax": "0.00",
"total": "12.99",
"total_tax": "0.00",
"taxes": [],
"sku": "1"
"parent_name": "tinytag"
},
In that example, I end up with an entry in my order table like this:
It then splits those items to two lines in the other table, when it should be three:
My back end workflows look like this:
API workflow new_order
API workflow order_split
My question is, how would I create a new thing in my database for items when multiples of the same variation are ordered? Presume I need to do something with the line_item quantity, but then how do I get bubble to loop on the variation ID and quantity?
Really hope that makes sense! Thanks in advance.