Hello-
I have multiple line items that i’m trying to post. During the GET request, each line item field is stored as a global variable.
The problem is that sometimes I have one line item only that I want to post and then the next run of the request I could have two line items that I want to post.
How do I create an ‘if’ conditional statement in order to only grab the stored variables that are associated to the number of line items.
i.e
"line_items" : [
{
"title" : "{{product_Name1}}" ,
"variant_title" : "{{product_desc1}}" ,
"description" : "{{product_desc1}}" ,
"Quantity" : "{{product_Count1}}" ,
"amount" : "{{product_price11}}" ,
"total_price" : "{{product_price11}}" ,
"currency" : "{{product_unit1}}" ,
"weight" : 3 ,
"weight_unit" : "oz"
}
,
if ("{{purchasedItemsCount}}" > 1)
{
“title” : “{{product_Name2}}” ,
“variant_title” : “{{product_desc2}}” ,
“description” : “{{product_desc2}}” ,
“Quantity” : “{{product_Count2}}” ,
“amount” : “{{product_price22}}” ,
“total_price” : “{{product_price22}}” ,
“currency” : “{{product_unit2}}” ,
“weight” : 3 ,
“weight_unit” : “oz”
}
]