Created
March 4, 2020 19:05
-
-
Save hedqvist/eb430ea074eb18640c0170222be2cc83 to your computer and use it in GitHub Desktop.
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; | |
| }else{ | |
| $create_invoice = false; | |
| } | |
| return $create_invoice; | |
| } | |
| add_filter('obj_fortnox_create_order_create_invoice', 'redlight_fortnox_create_invoice_for_swish_orders', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment