Order Printer / Including refunded items.

New Member
2 0 0

I am looking to include items that we've refunded in ana order as a line item on our invoice.

Specifically, the name of the item I have just refunded.

 

Yet, here is a lot a misinformation on Shopify's Liquid Variable Reference (for both notifications and Order Printer)  

I want:

{% for refund in refunds %}
{% for refund_line_item in refund.refund_line_items %}
    Refund line item quantity	
    {{ refund_line_item.quantity }}
    Refund line item	
    {{ line_item }}
{% endfor %}
{% endfor %}

Which will give me the qty, but I cannot pull the line item name. (simply "line_item" was my latest attempt)

 

I can run a list of variables for refund_line_items

{% for refund in refunds %}
{% for refund_line_item in refund.refund_line_items %}
   {{ refund_line_item | json }}
{% endfor %}
{% endfor %}

which returns the following (non-pertinent info omitted for an example refund):

{"id":118068420,"line_item":
{"base":
{"id":118068420,"quantity":1,"line_item_id":6907048708,"line_item":
{"id":6907048708,
"variant_id":12920327876,
"title":"Button Up / Corduroy",
"quantity":1,
"price":"85.00",
"grams":454,
"sku":"",
"variant_title":"SM",
"vendor":"",
"fulfillment_service":"manual",
"product_id":836198148,
"requires_shipping":true,
"taxable":false,
"gift_card":false,
"name":"Button Up / Corduroy - SM",
"variant_inventory_management":"shopify",
"properties":[],
"product_exists":true,
"fulfillable_quantity":0,
"total_discount":"0.00",
"fulfillment_status":"fulfilled",
"tax_lines":[],
"origin_location":
{"id":246110020,
"country_code":"US",
"province_code":"",
"name":"",
"address1":"",
"address2":"",
"city":"",
"zip":""},
"destination_location":
{"id":463003972,
"country_code":"US",
"province_code":"",
"name":"",
"address1":"",
"address2":"",
"city":"",
"zip":""}
}
}
},
"line_item_id":6907048708,"quantity":1}

 

I want: "name":"Button Up / Corduroy - SM" but I cannot tell if I am not using the correct variable or if it is not permitted.

 

I am already aware of certain limitations of Order Printer (no line item discount prices)

Anybody out there familiar with these liquid variables?

Even a simple "ya can't do that" would be awesom so I know Ican stop trying :)

Thanks,

Austin

igwtnyc.com

0 Likes
Highlighted
Shopify Staff
Shopify Staff
114 0 17

Hey Austin! 

Dave here from  the Guru Team :) 

 

This was a tricky one! It transpires that there needed to be a little check that the line item was matching it's ID before displaying, after some fooling around and adding another for and if statement this code now works: 

{% for refund in refunds %}
{% for refund_line_item in refund.refund_line_items %}
   {{ refund_line_item.title }}
    Refund line item quantity:    
    {{ refund_line_item.quantity }} </br>
    Refund line item: </br>    
     {% for line in line_items %}
                {% if refund_line_item.line_item_id == line.id %}
                {{ line.title }}
                {% endif %}   
        {% endfor %}
{% endfor %}
{% endfor %}

Hope this helps with getting your refunds displaying correctly! 

All the Best, 

Dave | Shopify

1 Like
Highlighted
New Member
2 0 0

David!

This is what I've been looking for!

I haven't tweaked with it much yet, but the variables are showing up in your argument-  awesome.

You should pass this info on to the "Order Printer / Liquid Variable Reference", or at least take down current section on refunds as it is incorrect. (pic for reference below).

Also here, https://help.shopify.com/manual/sell-online/notifications/email-variables#refunds-properties  ,  I understand it is not order printer, but my trials incuded placing the previously suggested code from these sources on the notifications platform to no avail.

___

Similar question, one of the most commonly refunded items are shipping charges. Is there a variable argument that would pick this up?

Thank you mucho,

Austin

igwtnyc.com

 

0 Likes
Highlighted
Tourist
6 0 1

Hi everyone,

I'm wondering how I can display single Item price on refunds, my snippet so far is this one:

    <tbody>
    {% assign total_refunds =  0.0 %}
    {% for transaction in transactions %}
        {% if transaction.kind == "refund" and transaction.status == "success" %}
            {% assign total_refunds = total_refunds | plus: transaction.amount %}
        {% endif %}
    {% endfor %}
    <tr>
{% for refund in refunds %}
{% for refund_line_item in refund.refund_line_items %}
   {{ refund_line_item.title }}
   <td>{{ refund_line_item.quantity }}</td> 
   <td><strong>{% for line in line_items %}
                {% if refund_line_item.line_item_id == line.id %}
                {{ line.title }}</strong></td>
                <td>{{ refund_line.line_item.price | money  }}</td>
                {% endif %} 
                
        {% endfor %}
{% endfor %}
{% endfor %}
</tr>
</tbody>

It works fine so far, but I've to show the amount per Item or per line, I read the instructions on refund_line_item so far and it tells me the following:

PropertyDescription

refund_line.line_item

The line_item that is being refunded. This has access to all the line_item’s properties.

and following that one you normaly have access to the line.item's properties where the .price property is available, but when I try that it doesn't work. Therefore I ask you all if there is someone who tried that and or can help me out with that?

Many thanks,

Metzler Thierry

 

0 Likes
Highlighted
New Member
5 0 0

Hi Dave_E

Is it possible to use your code in the Shipping Confirmation email. 

(it did not work just to copy paste it into the notification template). 

 

What should I do to come around with this? 

0 Likes