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 - 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 - 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 - 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 Default weight to parcel | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.5.3 | |
| */ | |
| function redlight_unifaun_minimum_weight( $shipment, $order) { | |
| foreach( $shipment['parcels'] as $i => $parcel ) { | |
| if( $shipment['parcels'][$i]['weight'] < 0.150 ){ | |
| $shipment['parcels'][$i]['weight'] = 0.150; |
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 - Swish Ecommerce by Redlight Media - Justera meddelande i betalningsförfrågan till att endast innehåll ordernummer | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.6.2 | |
| */ | |
| function redlight_swish_ecommerce_paymentrequest_message_ordernumber ( $message, $order ) { | |
| $message = $order->get_order_number(); | |
| return $message; | |
| } |
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 - Sets size of shippinglabel to 107x190 (thermo-190) | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.5.3 | |
| */ | |
| function redlight_unifaun_pacsoft_pdf_label( $pdf_config, $order ) { | |
| $pdf_config['target1Media'] = 'thermo-190'; | |
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 - Custom Logic for YITH Request a Quote | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.6.2 | |
| */ | |
| function redlight_fortnox_ywraq( $is_offer, $order_id ) { | |
| $order = new WC_Order($order_id); | |
| if( 'yes' === $order->get_meta('ywraq_raq',true) ){ | |
| $is_offer = 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 - Sets custom reference in Unifaun | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.7.0 | |
| */ | |
| function redlight_unifaun_reference( $shipment, $order ) { | |
| $shipment['senderReference'] = 'TOP-' . $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 | |
| add_action('woocommerce_order_status_changed', array($this, 'redlight_custom_update_woocommerce_order_status'), 10, 3); | |
| /** | |
| * @snippet WooCommerce - Fortnox plugin by Redlight Media - Sync order on "on-hold" | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.7.0 | |
| */ | |
| public function redlight_custom_update_woocommerce_order_status($order_id, $old_status, $new_status) { | |
| if ('on-hold' == $new_status): | |
| // cCheck if this order should be created as offer |