{"id":16939711,"date":"2023-08-01T20:53:33","date_gmt":"2023-08-01T20:53:33","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/export-functionality-not-working\/"},"modified":"2023-08-01T20:53:33","modified_gmt":"2023-08-01T20:53:33","slug":"export-functionality-not-working","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/export-functionality-not-working\/","title":{"rendered":"Export Functionality not working."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I had an issue with the export not working trying to export 5 orders. Since I am a developer, I looked at the error. In your file \/wc-customer-source\/includes\/wccs-admin-export.php where you are calling the get_billing_first_name() on the order. It errors on a refunded or failed order. This is because a refunded order is not a WC_Order. I added a check to make sure that the order you are exporting is a WC_Order and if not to get the parent order. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I added four lines to your code after the foreach begins: Line 64 or so.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>            \/\/In cases where the order is actually a refund or failed then the billing last name is not set. You must get the parent order.\n            if ( ! is_a( $order, 'WC_Order' ) ) {\n                $order = new WC_Order(  $order-&gt;get_parent_id() );\n            }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will get the parent order if the order is not a valid WC Order. Please implement this fix in the next version. We were able to export over 100 orders after this fix.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"template":"","class_list":["post-16939711","topic","type-topic","status-publish","hentry","topic-tag-errors","topic-tag-export"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16939711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16939711\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16939711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}