Created
February 27, 2018 18:50
-
-
Save hedqvist/7647282cd219db064f329284f35e0db9 to your computer and use it in GitHub Desktop.
Set InvoiceDate based on OrderDate via functions.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @snippet WooCommerce - Fortnox plugin by Redlight Media - Set InvoiceDate based on OrderDate via functions.php | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.2.5 | |
| */ | |
| function redlight_fortnox_payment_method_invoicedate($invoice, $order_id) { | |
| $order = new WC_Order($order_id); | |
| $invoice['Invoice']['InvoiceDate'] = $order->get_date_created()->format("Y-m-d"); | |
| return $invoice; | |
| } | |
| add_filter('obj_fortnox_update_invoice_params', 'redlight_fortnox_payment_method_invoicedate', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment