Support » Plugin: Advanced Order Export For WooCommerce » No Invoice and no tax class for refunds

  • Resolved MerlinRose

    (@merlinrose)


    Hello,

    i’m exporting all products with there tax rates (in Germany we have 7% and 19%) and invoice numbers from woocommerce germanized. That works fine but not on refunds. The invoice number are missing and the tax rate show 0. Is there a way to show these lines too for refunds?

    Thanks,
    Merlin

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi Merlin

    I’m sorry for late reply, I’ll provide solution today.
    Alex

    Plugin Author algol.plus

    (@algolplus)

    hi Merlin

    1. tax rate – it seems to be a bug.
    Could you edit file \classes\core\class-wc-order-export-data-extractor.php
    replace line
    $row[ $field ] = ( $subtotal_amount > 0 ) ? round( 100 * $subtotal_tax / $subtotal_amount, 2 ) : 0;
    with line
    $row[ $field ] = ( $subtotal_amount <> 0 ) ? round( 100 * $subtotal_tax / $subtotal_amount, 2 ) : 0;

    2. invoice number.
    Woocommerce creates child order for each refund.
    So refund should pull value from parent/main order.
    Can you upload your settings to helpdesk ? Use tab “Tools” to get them.

    thanks, Alex

    Hello Alex,

    1. Replacing the lines works fine. Now i get the tax rate for refunds.

    2. I have send my settings via Helpdesk for the invoice numbers.

    Thanks,
    Merlin

    Your solution you send me works fine!

    Thanks a lot!

    Plugin Author algol.plus

    (@algolplus)

    here is tweaked code to get invoice numbers from woocommerce germanized

    add_filter('woe_get_order_value_germanized_invoice_numbers', function ($value,$order, $field) {
    if( $order->post->post_type == "shop_order_refund")
        $invoices = wc_gzdp_get_invoices_by_order( wc_get_order( $order->get_parent_id() ) );
    else
        $invoices = wc_gzdp_get_invoices_by_order( $order );
        if( $invoices ) {
            $numbers = array();
            foreach ( $invoices as $id => $invoice ) {
                $numbers[] = $invoice->get_title();
            }
            $value = join(", ", $numbers);
        }
        return $value;
    }, 10, 3);
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘No Invoice and no tax class for refunds’ is closed to new replies.