Zapier Python Not Retrieving All Product Line Item Names

I am attempting to transfer customer details, such as address, email, phone number, and purchased products from Shopify to Google Sheets through Zapier. However, I’ve encountered an issue where only the first product is being fetched when a purchase includes multiple items. I need a solution to retrieve all item names from the customer’s order.

Here’s my current Python code:

def pair_items(item_list):
result =
for idx, item in enumerate(item_list):
if idx % 2:
continue
result.append(f’{item} {item_list[idx + 1]}')
return result

def fetch_item(lst, idx):
return lst[idx] if idx < len(lst) else ‘none’

quantities = input[‘quantities’].split(‘,’)
items = input[‘items’].split(‘,’)
timestamps = pair_items(input.get(‘timestamps’, ‘’).split(‘,’))

final_output =

for idx, item in enumerate(items):
final_output.append({
‘quantity’: fetch_item(quantities, idx),
‘item’: item,
‘contact’: input[‘contact’],
‘note’: input.get(‘note’, ‘’),
‘location’: input[‘location’],
‘order_status’: input[‘order_status’],
‘last_name’: input[‘last_name’],
‘first_name’: input[‘first_name’],
‘email_address’: input[‘email_address’],
‘timestamp’: fetch_item(timestamps, idx)
})

return final_output