Order Printer: order_adjustments cannot be read from refunds?

tjetta
New Member
1 0 0

Goal: I want to print a refunded tax amount on an invoice. The only dataset where I can find this piece of data is in the object "refunds":

 

[
 {
    "base":{
      "id":12345,
      "order_id":12345,
      "created_at":"2021-02-04T11:55:49.000Z",
      "note":"test",
      "user_id":12345,
      "processed_at":"2021-02-04T11:55:49.000Z",
      "restock":false,
      "duties":[],
      "total_duties_set":{},
      "admin_graphql_api_id":"gid://shopify/Refund/12345",
      "refund_line_items":[],
      "transactions":[],
      "order_adjustments":[ 
        {
          "id":12345,
          "order_id":12345,
          "refund_id":12345, 
          "amount":"-4.92",
          "tax_amount":"-0.98",
          "kind":"shipping_refund",
          "reason":"Shipping refund",
          "amount_set":{
            "shop_money":{
              "amount":"-4.92",
              "currency_code":"EUR"
            },
            "presentment_money":{
              "amount":"-4.92",
              "currency_code":"EUR"
            }
          },
          "tax_amount_set":{
            "shop_money":{
              "amount":"-0.98",
              "currency_code":"EUR"
            },
            "presentment_money":{
              "amount":"-0.98",
              "currency_code":"EUR"    
            }
          }
        }
      ]
    }
  }
]

 

 

 

I want to have access to amount and tax_amount in all occasions of order_adjustments.

 

I tried my luck with the following:

 

 

{% for refund in refunds %}

  Refund id: {{ refund.id }}<br/>
  Order id: {{ refund.created_at }}<br/>
  Order adjustments: {{ refund.order_adjustments.size }}<br/>

  {% for order_adjustment in refund.order_adjustments %}
    Amount: {{ order_adjustment.amount }}<br/>
    Tax amount: {{ order_adjustment.amount }}<br/>
  {% endfor %}

{% endfor %}

 

 

The output is as follows:

 

 

Refund id: 12345
Order id: 2021-02-04 12:55:49 +0100
Order adjustments:

 

 

 

Why am I unable to read order_adjustments and its containing data?

 

0 Likes
altabos
New Member
1 0 0

I'm seeing the same thing.  I need to put the order_adjustment amount for shipping refund on the report.

0 Likes