• Resolved Machine IT Services

    (@machineitsvcs)


    I am unable to use the get_refunds() function to get orders reliably in PHP. The function returns an empty array, and even the separate get_qty_refunded_for_item($item_id) returns 0 at the same time, when I know there are refunds, and I can get them at a later time. I’m trying to figure out what function needs to be called for these refunds to be available prior to my calling the get_refunds function, as my best guess is that they are being made available slightly later. As a test, I added “error_log(json_enocde((bool) $this->refunds));” within the get_refunds function, after $this->refunds is set using the wc_get_refunds query, and on order page load, it first returns false, and then returns true after page load. However, I’m trying to call get_refunds during the “init” and “add_meta_boxes” actions, so I can’t wait until after page load. I’d like to know how to make this information available sooner if possible.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Cannot get_refunds() in PHP’ is closed to new replies.