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 customer note as deliveryInstruction in Unifaun | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 7.5.0 | |
*/ | |
function redlight_unifaun_customer_portkod( $shipment, $order ) { | |
// How to add Custom DoorCode | |
if(!empty( $order->get_meta('portkod') ) ){ | |
$shipment['receiver']['doorCode'] = $order->get_meta('portkod'); |
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 - Blacklist dates for Gordon Delivery | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.9.0 | |
*/ | |
function redlight_gordon_blacklist_certain_days( $date_array ) { | |
//På söndagar efter 23, hantera det som midnatt |
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 - Custom Price functions | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 6.0.0 | |
*/ | |
function redlight_fortnox_order_item_special_price( $orderItem, $item, $product_id, $order ) { | |
$product = wc_get_product($product_id); | |
$full_price_products = array('MIL-SATT-40KM','BOM-KOR'); // Out products that should be full price | |
if( !in_array( $product->get_sku(), $full_price_products ) ){ |
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 - Dont use Application Passwords EVER | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 7.2.0 | |
*/ | |
add_filter('wp_is_application_passwords_available', '__return_false', 10); |
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 LETTER for certain orders and LABEL for certain | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 7.2.0 | |
*/ | |
function redlight_postnord_papersize( $papersize, $order ) { | |
$shipping_method = $order->get_shipping_method(); | |
if( in_array( $shipping_method, array( 'Ombud', 'Hemleverans' ) ) ){ | |
$papersize = 'LABEL'; |
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 - Fortnox plugin by Redlight Media - Hämta lagersaldo från en 'i lager' istället för Disponibelt antal | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 6.8.0 | |
*/ | |
function redlight_fortnox_stock_quantity_in_stock ( $DisposableQuantity, $WC_Product, $fortnox_article ) { | |
return $fortnox_article->Article->QuantityInStock; | |
} | |
add_filter('obj_fortnox_product_stock_amount', 'redlight_fortnox_stock_quantity_in_stock', 10,3 ); |
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 - Fortnox plugin by Redlight Media - Dont send remarks to fortnox | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 6.0.0 | |
*/ | |
function redlight_fortnox_dont_send_remarks( $orderData, $order_id) { | |
$orderData['Order']['CopyRemarks'] = false; | |
$orderData['Order']['Remarks'] = ""; | |
return $orderData; |
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 - Set Default Weight per article to 250g (weight is returned in kilograms) | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 6.0.0 | |
*/ | |
function redlight_postnord_default_weight( $default_weight ) { | |
$default_weight = 0.250; | |
return $default_weight; | |
} |
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 6.0.0 | |
*/ | |
function redlight_unifaun_dhl_addon_spbag( $shipment, $order ) { | |
// Only ASPO - DHL Service Point | |
if( 'ASPO' === $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 - Use item name from WooCommerce | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 6.0.0 | |
*/ | |
function redlight_fortnox_order_item_name( $orderItem, $item, $product_id, $order ) { | |
$orderItem['Description'] = $item->get_name(); | |
return $orderItem; | |
} |
NewerOlder