Last active
February 7, 2022 10:29
-
-
Save hedqvist/b7b2f65245d3e9c00424daef2c1c524f to your computer and use it in GitHub Desktop.
Fortnox - Swish Payments as Cash Invoice
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 ) { | |
| case 'stripe': | |
| case 'redlight_swish': | |
| case 'redlight_swish-ecommerce': | |
| $invoice['Invoice']['InvoiceType'] = 'CASHINVOICE'; | |
| break; | |
| default: | |
| $invoice['Invoice']['InvoiceType'] = 'INVOICE' ; | |
| } | |
| return $invoice; | |
| } | |
| add_filter('obj_fortnox_update_invoice_params', 'redlight_fortnox_swish_invoicetype', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment