Unable to resolve line_item title in order created using Orders API

Highlighted
New Member
2 0 0

Hi all,

I'd appreciate any assistance in this issue, hopefully I'm just missing something obvious.

I'm looking to control whether a customer sees a digital download link based on the title of items in their order.  For a simple test, I've used the following code in my checkout "additional scripts" area:

{% for line in checkout.line_items %} {{ line.title | json }} {% endfor %}

It works for an order created via "Online store", but not via Orders API with entries that have a valid title field.  Pulling the Order objects from the API, the content we're looking at in the code looks the same.

Here's the result of a correct order, including the test print of the value (highlighted):

example1.PNG

Here's what the same order looks like via API:

example2.PNG

Anyone with more experience with this know why this might not be working?  It should be a pretty simple thing--I have no idea why an order created by API wouldn't read the same.  There are some other values in the Order object that are different, perhaps those enter into it?

Here's a side-by-side of both orders:

sidebyside.png

0 Likes
Highlighted
New Member
2 0 0

Alright, figured it out, I just need to call the order itself, not the checkout object.

{% for line in order.line_items %} works just fine.

0 Likes