Discussing APIs and development related to customers, discounts, and order management.
We are using this code to get price and sku to show on our packing slips for each item in the order. However sometimes sku is not displayed and sometimes prices in not displayed. Sometimes the price is 0 aswell. I cannot find any reason when looking at the products for this. Is there a solution to this?
"{% assign final_price = nil %}
{% assign line_name = line_item.title %}
{% if line_item.variant_title != blank %}
{% assign line_name = line_name | append: " - " | append: line_item.variant_title %}
{% endif %}
{% for item in order.line_items %}
{% assign order_name = item.title %}
{% if order_name == line_name %}
{% assign final_price = item.final_price %}
{% endif %}
{% endfor %}
{% if final_price %}
{{ final_price | money }}
{% endif %}"
There is no line_item.variant_title, use line_item.variant.title instead. Then try again.