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 - Set Project | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.1.1 | |
| */ | |
| function redlight_fortnox_order_project( $orderData, $order_id) { | |
| switch( get_site_url() ){ | |
| case 'https://www.example.com': |
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
| /** | |
| * @snippet WooCommerce - Sets Weight on Parcels (Overwrites weight total) | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.4.0 | |
| */ | |
| function redlight_unifaun_parcel_weight( $shipment, $order) { | |
| foreach( $shipment['parcels'] as $i => $parcel ) { | |
| $shipment['parcels'][$i]['weight'] = 0.250; | |
| } | |
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 - BankID - Dont display "Age verification: Via BankID" in cart and meta. | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.1.1 | |
| */ | |
| add_filter( 'redlight_bid_woocommerce_display_cart_item_data', '__return_false' ); |
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 - Solve South Korea until Fortnox fixes backend | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.1.0 | |
| */ | |
| function redlight_fortnox_south_korea( $orderData, $order_id) { | |
| //$order = new WC_Order($order_id); | |
| if( $orderData['Order']['Country'] == 'South Korea' ){ | |
| $orderData['Order']['Country'] = 'Korea, Republic of'; |
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 - Add custom status | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.1.1 | |
| */ | |
| add_filter('wc_order_statuses', 'add_custom_order_status' ); | |
| public function add_custom_order_status( $order_statuses ){ | |
| $order_statuses['wc-fetched'] = __('Fetched'); | |
| return $order_statuses; |
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 - Unifaun - Set receiverReference tp order ID | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.1.1 | |
| */ | |
| function redlight_unifaun_receiver_reference( $shipment, $order ) { | |
| $shipment['receiverReference'] = $order->get_order_number(); | |
| return $shipment; | |
| } |
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 ADDON to Shipment | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.2.0 | |
| */ | |
| function redlight_unifaun_dhl_addon( $shipment, $order ) { | |
| // Only AEX | |
| if( 'AEX' === $shipment['service']['id'] ){ | |
| $shipment['service']['addons'][] = array( |
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 - BankID plugin by Redlight Media - Add Age control on all products | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.2.0 | |
| */ | |
| add_action( 'woocommerce_add_cart_item_data', 'limit_all_products', 10, 3 ); | |
| function limit_all_products( $cart_item_data, $product_id, $variation_id ) { | |
| $cart_item_data['is_age_verification_required'] = 'yes'; | |
| return $cart_item_data; |
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 - Bookeep only Swish Orders | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.2.0 | |
| */ | |
| function redlight_fortnox_bookeep_swish($should_bookeep,$order_id, $updated_order) { | |
| $order = wc_get_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 - Set Terms and PaymentWay if Swish or Stripe order | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.2.0 | |
| */ | |
| function redlight_fortnox_swish_invoicetype($invoice, $order_id) { | |
| $order = wc_get_order($order_id); | |
| $order_payment_method = $order->get_payment_method(); | |
| switch( $order_payment_method ) { |