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 Dimensions to Schenker Parcel | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.5.3 | |
| */ | |
| function redlight_unifaun_schenker_dimensions( $shipment, $order) { | |
| if( 'BHP' === $shipment['service']['id'] ){ | |
| foreach( $shipment['parcels'] as $i => $parcel ) { | |
| $shipment['parcels'][$i]['length'] = 240; |
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 ordernumber to Fortnox ExternalInvoiceReference1 field | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.5.3 | |
| */ | |
| function redlight_fortnox_order_external_reference( $orderData, $order_id) { | |
| $order = new WC_Order($order_id); | |
| $orderData['Order']['ExternalInvoiceReference1'] = $order->get_order_number(); | |
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 - Update Article name to article in Fortnox via functions.php | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.5.3 | |
| */ | |
| function redlight_update_article( $article, $product_id) { | |
| $WC_Product = wc_get_product($product_id); | |
| $article->Article['Description'] = $WC_Product->get_name(); |
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 fee to AdministrativeFee via functions.php | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.2.5 | |
| */ | |
| function redlight_fortnox_administrative_fee( $orderData, $order_id ) { | |
| // Get the total fees of this order | |
| $order = wc_get_order($order_id); | |
| $fees = $order->get_fees(); |
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]); |
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 - (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 - (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 - 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 - 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; |