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 InvoiceType depending on payment method via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_payment_method_invoicetype($invoice, $order_id) { | |
$order = wc_get_order($order_id); | |
$order_payment_method = $order->get_payment_method(); | |
switch( $order_payment_method ) { |
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"); |
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 ); |
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 - Add Company Name to Fortnox order Name | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.3.5 | |
*/ | |
function redlight_fortnox_order_companyname( $orderData, $order_id) { | |
$order = new WC_Order($order_id); | |
if(!empty($order->get_billing_company())){ | |
$orderData['Order']['CustomerName'] = $order->get_billing_company().": "; |
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 - Add order currency to Fortnox | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.3.5 | |
*/ | |
function redlight_fortnox_order_currency( $orderData, $order_id) { | |
$order = new WC_Order($order_id); | |
$orderData['Order']['Currency'] = $order->get_currency(); | |
return $orderData; |
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 - Dont copy remarks | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_dont_copy_remarks( $orderData, $order_id) { | |
$orderData['Order']['CopyRemarks'] = false; | |
return $orderData; | |
} |
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 - (REGISTRED USERS) Set $our_custom_field as Comment field to Fortnox via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.0.6 | |
*/ | |
function redlight_custom_customerdata( $customer) { | |
$our_custom_field = (!empty($_POST['our_custom_field'])) ? $_POST['our_custom_field'] : ""; |
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 - (GUEST USERS) Set $our_custom_field as Comments on Customer | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.4.2 | |
*/ | |
function redlight_fortnox_guest_customer_data( $customer, $order_id ) { | |
$order = wc_get_order( $order_id ); | |
$our_custom_field = $order->get_meta('our_custom_field'); |
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 - Add Company Name to Fortnox order Name | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.3.5 | |
*/ | |
function redlight_fortnox_order_companyname( $orderData, $order_id) { | |
$order = new WC_Order($order_id); | |
if(!empty($order->get_billing_company())){ | |
$orderData['Order']['CustomerName'] = $order->get_billing_company(); |
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 - Remove and Post_meta rows in Fortnox via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_remove_postmeta($orderData) { | |
foreach($orderData['Order']['OrderRows'] as $i => $item) { | |
if(isset($item['AccountNumber']) && $item['AccountNumber'] == 'API_BLANK') | |
unset($orderData['Order']['OrderRows'][$i]); |