Created
May 7, 2018 08:19
-
-
Save hedqvist/53603303f67b3ab4825cacc73e833769 to your computer and use it in GitHub Desktop.
Klarna External references Fortnox
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 - Adds Klarna Invoice and ordernumber to Fortnox ExternalInvoiceReference1 & ExternalInvoiceReference2 fields | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.3.5 | |
| */ | |
| function redlight_fortnox_klarna_invoice_order_reference( $orderData, $order_id) { | |
| $order = new WC_Order($order_id); | |
| $klarna_invoice_number = get_post_meta( $order->id, '_klarna_invoice_number', true ); | |
| $klarna_order_reservation = get_post_meta( $order->id, '_klarna_order_reservation', true ); | |
| $orderData['Order']['ExternalInvoiceReference1'] = $klarna_invoice_number; | |
| $orderData['Order']['ExternalInvoiceReference2'] = $klarna_order_reservation; | |
| return $orderData; | |
| } | |
| add_filter('obj_fortnox_order_data', 'redlight_fortnox_klarna_invoice_order_reference', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment