• Resolved eok

    (@eok)


    Hi, i love your plugin.. but now something goes worng. Some invoice are generated with wrong date (order date and the date in the invoice are different) and some are generated correctly. How is possible?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! The invoice date reflects the date when the invoice is created, this is not necessarily the same as the order date if the invoice was paid on a later date. (just like the order number is not the same as the invoice number).

    If you want to use the order date as invoice date, you can do this with a filter:

    
    add_action( 'wpo_wcpdf_invoice_get_date', 'wpo_wcpdf_order_data_as_invoice_date', 10, 2 );
    function wpo_wcpdf_order_data_as_invoice_date( $date, $document ) {
        if ($document->get_type() == 'invoice' && !empty($document->order)) {
            $date = $document->order->get_date_created();
        }
        return $date;
    }
    

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters.

    Hope that helps!
    Ewout

Viewing 1 replies (of 1 total)
  • The topic ‘Wrong date generated’ is closed to new replies.