What is your goal?
Hello
I need to get all line items from a deal, filter them by category to only show the main product not accessories. I can do this part. However, we offer buy one get one half price so i am stuck on combining the collections and then choosing which one is the lower value to add BOGO text in hubspot against that line item. I made API call to hubspot that returns 4 operations, 2 of which are product and the other two are accessories. I filtered the product only lines so the operations are down to 2.
What is the problem & what have you tried?
I tried itegrator and aggregator but it still outputs two operations where i want to add both of them into one array to then do functions on them. Which modules do i need to do?
Screenshots (scenario flow, module settings, errors)
Hey there,
Your aggregator source module is wrong. Check which module is producing the extra bundles. From the screenshot alone it looks like its something before the HubSpot module.
Hello,
This is a classic “compare two bundles” problem that exists in Make.
You’ve already filtered the 2 products down but Make still treats them as separate, thus you cannot compare them directly. You will need to bring them into a new single array at least temporarily in order to evaluate them.
You likely DO NOT NEED the ITERATOR before the Array Aggregator. The aggregator can aggregate straight from filtered bundles.
So first
- Hubspot API Call
- Filter product line items
Then
Use an Array Aggregator
This will be your filtered line items as your source. Your target will be custom and you can then map the fields you need (line item ID + price) creating a single bundle with an array of two products.
Create a Set Variable or Iterator + function
Try to sort the array by ascending price. The first item will be the lower BOGO price. You could also use min() to determine the lowest price.
Iterate Again
Once you have determined which product is cheaper you can split the array back into bundles. Use a filter like: “line item ID = cheaper item ID” and update only the line item in Hubspot with BOGO text.