Created
August 12, 2020 13:14
-
-
Save hedqvist/8ade7e4e81dee657439b770979cb4950 to your computer and use it in GitHub Desktop.
Fortnox - Klarna Reference
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.0.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