Once the user has selected more than 1 item, my code adds the item to a new object called MyBundle, i then need to loop over setBundles > products object and if it matches, return the object to then be able to apply discount to the total price, and do more etc.
Hope this makes sense.
Thanks.
First Object
{
"setBundles": [
{
"id": "9386256957757",
"name": "bundle 1",
"products": [
{
"id": "8085260075325",
"name": "prod 1"
},
{
"id": "9386890854717",
"name": "prod 2"
},
{
"id": "9387414257981",
"name": "prod 3"
}
],
"discount": 10
},
{
"id": "9386998989117",
"name": "bundle 2",
"products": [
{
"id": "8085260075325",
"name": "prod 1"
},
{
"id": "8085261517117",
"name": "prod 4"
}
],
"discount": 12
},
{
"id": "9387393057085",
"name": "bundle 3",
"products": [
{
"id": "8085260075325",
"name": "prod 1"
},
{
"id": "9386890854717",
"name": "prod 5"
}
],
"discount": 15
}
]
}
Second Object
{
"MyBundle": [
{
"id": "8085261517117",
"image": "img.jpg",
"title": "prod 2",
"price": "35.00"
},
{
"id": "8085260075325",
"image": "img2.jpg",
"title": "prod 1",
"price": "40.00"
}
]
}
tried lots of different ways
New contributor
ElAitch96 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.