• I am developing a plugin that will be integrated with this plugin.
    I have the problem that my plugin change the order number with another but it is not recognized from this plugin.
    I am using the woocommerce_order_number filter but in your plugin code this is not used, so is possible add a filter to alter that number?
    The other way will be alter the _ywpi_invoiced post meta but i think that it isn’t optimal solution.

    https://www.ads-software.com/plugins/yith-woocommerce-pdf-invoice/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi Daniele,
    on the invoice template we write the order number calling the get_order_number() method on the order object.
    Where do you need this filter to be added?

    Well i need that the invoice can get my invoice number and not of yith, so if i can get a filter i can change with mine.
    Else use the woocommerce method natively like “WooCommerce PDF Invoices & Packing Slips” that in my case works without problem using the woocommerce filter.

    Plugin Author YITHEMES

    (@yithemes)

    Hi Daniele,

    I have the problem that my plugin change the order number with another but it is not recognized from this plugin.
    I am using the woocommerce_order_number..

    That filter works fine, if you change the order number from that filter, the new order number is displayed correctly on the invoice.
    Please pay attention that all the documents generated are stored as physical file so any subsequent change will not affect the invoice(you need to delete the previous if you want to update the file).

    Well i need that the invoice can get my invoice number and not of yith, so if i can get a filter i can change with mine.

    Sure we can add some filter when the new invoice number is generated and when is displayed, it is what you need?

    As you can see here it is not working: https://i.imgur.com/k8yJUIH.png
    In the invoice there is 13 and not 2016/12

    Plugin Author YITHEMES

    (@yithemes)

    Hi Daniele,
    we have added two filters that should be enough for helping you to achieve your goal.

    With ‘yith_ywpi_new_invoice_number’ you can manage the invoice number to be assigned to the new invoices.
    With ‘yith_ywpi_get_formatted_invoice_number’ you can overwrite how the standard numbering will be shown(replacing if you want, prefix and suffix).

    If you want to simply show the order number then in both cases, you can simple do “return $order->get_order_number();”

    Best regards

    Thank you, it is working.
    This is the code to use the new filters!

    add_filter( 'yith_ywpi_new_invoice_number','yith_invoice_number' , 9999, 2 );
    add_filter( 'yith_ywpi_get_formatted_invoice_number', 'yith_invoice_number' , 9999, 2 );
    
    function yith_invoice_number( $number, $order ) {
        return $order->get_order_number();
    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Filter to change the order number’ is closed to new replies.