Liquid cart include item variant

I’m trying to retrieve a cart object with Liquid like so

{{ cart | json }}

According to official documentation, I should see the following structure:

cart.items - array of line_items

line_item.variant - a product variant object

However, there’s no variant object on line_item.

But, if I fetch the variant like so, I do get it:

{{ cart.items.first.variant | json }}

Is there any way to instruct Liquid to include this object directly in the cart?

1 Like