Guest User

Untitled

a guest
Mar 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. add_action('woocommerce_checkout_process', 'pinion_add_order');
  2. function pinion_add_order($m, $a) {
  3. global $woocommerce;
  4. $address = array(
  5. 'first_name' => 'Project Paid ',
  6. 'last_name' => $m
  7. );
  8.  
  9. $order = wc_create_order();
  10. $order->add_product(($a == '100000' ? get_product('2858') : get_product('2859')), 1);
  11. $order->set_address($address, 'billing');
  12. $order->set_address($address, 'shipping');
  13. // $order->set_total($amount);
  14. $order->calculate_totals();
  15. $order->update_status("Completed", 'Imported order', TRUE);
  16.  
  17. return $order;
  18. }
Add Comment
Please, Sign In to add comment