Refund Invoice with Order Printer does not work properly

New Member
4 0 0

Hi Folks, 

I cannot settle a maybe very easy issue, I hope somebody can help...

I want to print a refund invoice for the customer and for our accountant.

With: 

{% for transaction in refund_transactions %}
 {{ transaction.amount | money }}
{% endfor %}

I can show the total amount wich has been refunded to the customer. This part works perfectly fine. 

I try to show further details of the transaction with the following code, but nothing shows up. 

{% for refund_line_item in refund.refund_line_items %}
  {{ refund_line_item.line_item | line_item.title }}
  {{ line_item.price | money }}
  {{ line_item.image | img_url: 'thumb' | img_tag }}
  {{ line_item.quantity }}
{% endfor %}

Can anyone see why this does not work?  (There are refunded items etc. in the respective order)

Any help is greatly appreciated. Thanks a lot!

Hannes

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
298 0 156

Hey!

It looks like it's just the for clause that's a bit off, what I think should work is:

{% for line in refund_line_items %}
{{ line.line_item.title }}
{{ line_item.price | money }}
{{ line_item.image | img_url: 'thumb' | img_tag }}
{{ line_item.quantity }}
{% endfor %}

The {% for line in refund_line_items %}​  comes straight out of the Refund Notification template, and normally it just calls Quantity and Title, so it should be a-ok to call a few other line_item details.

I'm not an API wizard, but I hope that helps! :)

0 Likes
Shopify Partner
3 0 0

I'm having the same problem. I can not print refunds from Order Printer.  When I set up a template with the code fragment: from above:

{% for line in refund_line_items %}
{{ line.line_item.title }}
{{ line_item.price | money }}
{{ line_item.image | img_url: 'thumb' | img_tag }}
{{ line_item.quantity }}
{% endfor %}

Nothing is printed when I select an order that contains refunds.

When I try the same code with some context and some line numbers for clarity:

​{% for refund in refunds %}
{% for line in refund.refund_line_items %}
{{ line.line_item.title }}(1) <br/>
{{ line_item.price | money }}(2) <br/>
{{ line_item.image | img_url: 'thumb' | img_tag }}(3)<br/>
{{ line_item.quantity }}(4) <br/>
{% endfor %}
{% endfor %}

​

I get the error message:

Liquid error: undefined method `name' for #(1) 
(2) 
Liquid error: filter "product_img_url" can only be called on product images(3)
(4) 
Liquid error: undefined method `name' for #(1) 
(2) 
Liquid error: filter "product_img_url" can only be called on product images(3)
(4) 

Finally, when I modify the code assuming that the variable line has line_item structure: (I dropped the image line because I don't need to show product images in my implementation:

{% for refund in refunds %}
{% for line in refund.refund_line_items %}
{{ line.title }}(1) <br/>
{{ line.price | money }}(2) <br/>
{{ line.quantity }}(4) <br/>
{% endfor %}
{% endfor %}

I just get the refund quantity printed:

(1) 
(2) 
2(4) 
(1) 
(2) 
1(4) 

Has anybody had success with using Order Printer on refund transactions? This is impacting my POS because I don't have a receipt printer installed. The best I can do is email my customer a receipt, but i don't think that this is a great option when someone is at my retail counter.

I've looked at the Order Printer Template creation software, but it doesn't have templates for refunds. It only creates Invoices, Packing Slips and Return Documents.

0 Likes

Hi Susan,

Bjorn here from the Order Printer Templates app. Thought I'd take a look to see if we could help out, but it seems that it's caused by a bug in Shopify's Order Printer app.

So you are actually not doing anything wrong, the code in your 2nd code block above should work.

I did the below to see what was being outputted by Order Printer, and it fails on the last line.. so we never get access to the actual line item itself :( Adding the json filter when working with this kind of thing can help you "see" the info better.

{% for refund in refunds %}
  {% for refund_line_item in refund.refund_line_items %}
   {{ refund_line_item.quantity }}<br><br>
   {{ refund_line_item | json }}<br><br>
   {{ refund_line_item.line_item | json }}
  {% endfor %}
{% endfor %}

Results in:

1

{  
   "id":46811521,
   "line_item":{  
      "base":{  
         "id":46811521,
         "quantity":1,
         "line_item_id":2770226369,
         "line_item":{  
            "id":2770226369,
            "variant_id":4908318273,
            "title":"Sneakers - Black / 40",
            "quantity":3,
            "price":"249.00",
            "grams":0,
            "sku":"SHOEBLACK40",
            "variant_title":"",
            "vendor":"Acme Corp",
            "fulfillment_service":"pp-mestermaling",
            "product_id":1618331585,
            "requires_shipping":true,
            "taxable":true,
            "gift_card":false,
            "name":"Sneakers - Black / 40",
            "variant_inventory_management":null,
            "properties":[  

            ],
            "product_exists":true,
            "fulfillable_quantity":2,
            "total_discount":"0.00",
            "fulfillment_status":"partial",
            "tax_lines":[  
               {  
                  "title":"VAT",
                  "price":"50.49",
                  "rate":0.0725
               }
            ]
         }
      }
   },
   "line_item_id":2770226369,
   "quantity":1
}

Liquid error: undefined method `reject' for LineItemDrop:LineItemDrop

I suggest sending an email to Shopify Support to let them know about the bug. I'll do the same from my side too ;)

Have a good Monday!

Cheers,
Bjorn

Founder - Order Printer Templates
https://apps.shopify.com/order-printer-templates

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
0 Likes
Shopify Partner
3 0 0

Thanks for the reply and the info about the JSON filter.  That was extremely helpful.  I have reported this and a large number of problems with refund reporting to support, but still no answer yet. I'm surprised that more customers aren't complaining about this because there is effectively no way to print a customer receipt from the POS for a refund transaction.

0 Likes

Hi Susan,

Good stuff, I wasn't aware that the refund side of things was so problematic :( Once they do fix it in Order Printer, I will be sure to add in some Refund templates in my Order Printer Templates app as well.. thanks for letting me know about the need for this.

Best of luck with everything!

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
0 Likes
Shopify Partner
3 0 0

Hi Bjorn-

I saw from your email blast that Order Printer Templates now support refund information. Thank you for helping to push this issue through. Now if I could just get somebody to do something about the fact that you can't print with Order Printer through the refund section of the POS, I'd really have something! :-)

0 Likes