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 depending on service | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.5.3 | |
| */ | |
| function redlight_unifaun_minimum_weight_per_service( $shipment, $order) { | |
| foreach( $shipment['parcels'] as $i => $parcel ) { | |
| if( $shipment['parcels'][$i]['weight'] < 0.150 && 'PUA' === $shipment['service']['id'] ){ | |
| $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 - Change Reference | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.0 | |
| */ | |
| function redlight_swish_custom_reference( $data, $order ) { | |
| $ref = $data['payeePaymentReference']; | |
| $data['payeePaymentReference'] = 'swish-'.$ref; |
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 - Change Service to MyPack Collect if order total over 1500 | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.0 | |
| */ | |
| function redlight_unifaun_mypack_over_1500( $shipment, $order ) { | |
| if($order->get_total() > 1500 ){ | |
| $shipment['service']['id'] = 'P19'; | |
| } |
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 - Translate any text :) | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.2 | |
| */ | |
| add_filter('gettext', 'translate_myText'); | |
| add_filter('ngettext', 'translate_myText'); | |
| function translate_myText($translated) { | |
| $translated = str_ireplace('myTextToReplace', 'myNewText', $translated); |
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 Terms and PaymentWay if Swish order | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.2 | |
| */ | |
| function redlight_fortnox_payment_method_invoicetype($invoice, $order_id) { | |
| $order = new WC_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 - Only create invoices that has payment method Swish | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.2 | |
| */ | |
| function redlight_fortnox_create_invoice_for_swish_orders( $create_invoice, $order_id) { | |
| $order = new WC_Order($order_id); | |
| if("redlight_swish-ecommerce" === $order->get_payment_method() ){ | |
| $create_invoice = 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 Tracking URL to Pacsoftonline | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.2 | |
| */ | |
| function redlight_pacsoft_tracking_base_url( $url, $order_id ) { | |
| $url = 'https://www.pacsoftonline.com/ext.po'; | |
| return $url; |
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 phone in Unifaun | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.2 | |
| */ | |
| function redlight_unifaun_custom_phone( $shipment, $order ) { | |
| $shipping_phone= $order->get_meta( '_shipping_phone', true ); | |
| if(!empty( $shipping_phone ) ){ |
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 - Orderscanner/Packstation - Get barcode from iZettle-plugin | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.0 | |
| */ | |
| function redlight_redlight_izettle_barcode( $meta_key ) { | |
| $meta_key = '_izettle_barcode'; |
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 Blank field in order to prevent details from customer card | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.2 | |
| */ | |
| function redlight_fortnox_prevent_autofill($orderData) { | |
| if(empty($orderData['Order']['Address2'])){ | |
| $orderData['Order']['Address2'] = "API_BLANK"; |