Support » Plugin: Advanced Order Export For WooCommerce » Is it possible to customise fetch_order_data without hard coding?

  • Resolved Tech Nomad

    (@alextechnomad)


    Hello!
    I am using your great plugin for a project, but has to export some custom fields (different German taxes) which are not shown by default under “Meta key” when I want to add an custom column to the exported table (under “Set up fields to export”).

    I couldn’t find a native solution to this so I hard coded the class-wc-order-export-data-extractor file on the lines 1157-1167 like this:

    } elseif($field == '7% Mehrwertsteuer') {
        $invoice_id               = get_post_meta( $order_id, "_invoices" )[0][0];
        $invoice_tax_totals       = get_post_meta( $invoice_id, "_invoice_tax_totals" );
        $value_7_prozent          = $invoice_tax_totals[0]["VAT (7%)-1"]->amount;
        $row['7% Mehrwertsteuer'] = $value_7_prozent;
    } elseif($field == '19% Mehrwertsteuer'){
        $invoice_id         = get_post_meta( $order_id, "_invoices" )[0][0];
        $invoice_tax_totals = get_post_meta( $invoice_id, "_invoice_tax_totals" );
        $value_7_prozent    = $invoice_tax_totals[0]["VAT (19%)-1"]->amount;
        $row['19% Mehrwertsteuer'] = $value_7_prozent;
    }

    But maybe there is a cleaner native solution to this? That would be great! Please let me know if there such a solution. Thank you in advance!

    Alex

    • This topic was modified 1 year, 6 months ago by  Tech Nomad.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Is it possible to customise fetch_order_data without hard coding?’ is closed to new replies.