Created
June 11, 2020 08:04
-
-
Save hedqvist/da84fa4fdec6af55a59348249b8dc289 to your computer and use it in GitHub Desktop.
Fortnox - Only Bookeep orders that has Swish as 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 - 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 ) { | |
| case 'redlight_swish': | |
| case 'redlight_swish-ecommerce': | |
| $should_bookeep = true; | |
| break; | |
| default: | |
| $should_bookeep = false; | |
| } | |
| return $should_bookeep; | |
| } | |
| add_filter('obj_fortnox_create_order_bookeep_invoice', 'redlight_fortnox_bookeep_swish', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment