Getting order line_item details using Python

Janice_L
New Member
3 0 0

Hi,

 

How do I get all the product details in a specific order using Python?

 

 

When I tried the following piece of python code, "order.line_items" just returned an id. 

I totally have no idea what the next step would be.

 

 

 

newOrders = shopify.Order.find(fulfillment_status="unfulfilled")

for id in newOrders:

    order_id = str(id)
    order_id =order_id.strip('order()')

    order = shopify.Order.find(order_id)

    item = str(order.line_items[0])
    item_id = item.strip("item()")

    details = shopify.LineItem.find(item_id) # not working

 

 

How am I able to fetch the product's SKU, title, and quantities for an order?

 

 

I've been searching online for a couple of hours, and there was another person who encountered the same problem.

 

 

It would be appreciated if anyone could guide me on how to tweak the code. 

 

 

Thanks in advance!

 

 

Janice

 

0 Likes