Skip to content

Instantly share code, notes, and snippets.

@trueqap
Created November 20, 2018 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save trueqap/d34dbb4a2ef76229eb4051439c1d3cd2 to your computer and use it in GitHub Desktop.
Save trueqap/d34dbb4a2ef76229eb4051439c1d3cd2 to your computer and use it in GitHub Desktop.
add_action('woocommerce_order_status_processing', 'wc_szamlazz_on_order_processing');
function wc_szamlazz_on_order_processing($order_id) {
 
  //Fizetési mód lekérése
  $order = new WC_Order($order_id);
  $payment_method = $order->get_payment_method();
 
  //Ha paypal-el lett fizetve és még nincs hozzá számla, csináljon egyet
  if(($payment_method == 'paypal' || $payment_method == 'barion') && !get_post_meta($order_id,'_wc_szamlazz',true)) {
    global $wc_szamlazz;
    $wc_szamlazz->generate_invoice($order_id);
    $wc_szamlazz->generate_invoice_complete($order_id);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment