This file contains 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 - Age-limit set to 18 | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.6.0 | |
*/ | |
function redlight_swish_age_limit( $data, $order ) { | |
$data['ageLimit'] = 18; | |
return $data; | |
} |
This file contains 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 4.5.1 | |
*/ | |
function redlight_unifaun_force_minimum_weight( $shipment, $order) { | |
foreach( $shipment['parcels'] as $i => $parcel ) { | |
$shipment['parcels'][$i]['weight'] = 0; | |
} |
This file contains 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 ExternalInvoiceReference2 field | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.5.0 | |
*/ | |
function redlight_fortnox_invoice_order_reference( $orderData, $order_id) { | |
$order = wc_get_order($order_id); | |
$orderData['Order']['ExternalInvoiceReference2'] = $order->get_order_number(); | |
This file contains 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 ADDON to Shipment | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.2.0 | |
*/ | |
function redlight_unifaun_prenot( $shipment, $order ) { | |
// Only PUA and 'Varubrev - Lämnas vid dörr' | |
if( 'P19' === $shipment['service']['id'] ){ | |
$shipment['service']['addons'][] = array( |
This file contains 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 -Unifaun - Set Customs Security printset | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.9.0 | |
*/ | |
function redlight_unifaun_customs_security( $customsDeclaration, $shipment, $order_id) { | |
//$order = new WC_Order($order_id); | |
if( 'BREKI' === $shipment['service']['id'] ){ | |
$customsDeclaration['printSet'] = ['SECURITY']; |
This file contains 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 - Print to different printerID if we are printing a packingslip | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.4.0 | |
*/ | |
function redlight_print_packingslip_to_custom_printer($printjob, $order) { | |
if( strpos($printjob['title'], 'Packingslip') !== false) { | |
$printjob['printerId'] = 123456; | |
} |
This file contains 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 - Print to different printerID depending on shipment method | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.4.0 | |
*/ | |
function redlight_print_labels_to_customer_printer($printjob, $order) { | |
if( strpos($printjob['title'], 'Packingslip') !== false) { | |
return $printjob; | |
} |
This file contains 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 107x72 (thermo-brev3) | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.4.0 | |
*/ | |
function redlight_unifaun_pacsoft_pdf_label( $pdf_config, $order ) { | |
if( 'Brev i posten' === $order->get_shipping_method() || 'Fri frakt' === $order->get_shipping_method() || 'Free delivery' === $order->get_shipping_method() || 'Postage' === $order->get_shipping_method() ){ | |
$pdf_config['target1Media'] = 'thermo-brev3'; | |
} |
This file contains 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
<? | |
/** | |
* @snippet WooCommerce - Adds ADDON to Shipment | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.9.0 | |
*/ | |
function redlight_unifaun_bhp_return( $shipment, $order ) { | |
// Only Schenker Ombud | |
if( 'BHP' === $shipment['service']['id'] ){ | |
$shipment['service']['addons'][] = array( |
This file contains 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 ); |