What are you trying to achieve?
Hi, I’m new to Make and need some help with setting up the following scenario:
I have a Shopify module that captures new orders from my Shopify store. Retrieved object contains line_items[]
array from the order, and I need to loop through this array to transform the data into a new structure that will be passed to the BaseLinker module.
I need map these Shopify fields from the line_items[]
array:
- variant_id
- product_id
- quantity
- price
- name
- sku
Into BaseLinker products[]
array:
- product_id
- variant_id
- name
- sku
- price_brutto
- quantity
I think the only field that needs changing is the price field, which should map to price_brutto in BaseLinker. However, I’m not sure if it’s possible to pass all the existing fields as-is and only modify the price, or if it’s necessary to create a new array with the required structure for BaseLinker.
Here are data examples:
Shopify order:
{
"order_id": 111111,
"line_items": [
{
"variant_id": 123456,
"product_id": 654321,
"quantity": 2,
"price": 50.00,
"name": "Product A",
"sku": "PROD-A"
},
{
"variant_id": 789012,
"product_id": 210987,
"quantity": 1,
"price": 100.00,
"name": "Product B",
"sku": "PROD-B"
}
],
}
Wanted structure for BaseLinker:
{
"order_id": 111111,
"products": [
{
"product_id": 654321,
"variant_id": 123456,
"name": "Product A",
"sku": "PROD-A",
"price_brutto": 50.00,
"quantity": 2
},
{
"product_id": 210987,
"variant_id": 789012,
"name": "Product B",
"sku": "PROD-B",
"price_brutto": 100.00,
"quantity": 1
}
],
}
Can anyone guide me on how to achieve this? Many thanks!