Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created March 4, 2020 19:05
Show Gist options
  • Select an option

  • Save hedqvist/eb430ea074eb18640c0170222be2cc83 to your computer and use it in GitHub Desktop.

Select an option

Save hedqvist/eb430ea074eb18640c0170222be2cc83 to your computer and use it in GitHub Desktop.
<?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