shop code

 

 

add_action(‘woocommerce_payment_complete’, ‘custom_process_order’, 10, 1);
function custom_process_order($order_id) {
$order = wc_get_order( $order_id );
$user = $order->get_user();
$mouser_id = get_current_user_id();
$user_info = get_userdata($myuser_id);
$items = $order->get_items();
foreach ($items as $item) {
if ($item[‘product_id’]==16388) {
$course_id = 16390;
$user = learn_press_get_user($myuser_id, false);

$item = array(
‘order_item_name’ => ‘HOW TO CHOOSE A BUSINESS NAME…ONE LIKELY TO GET REGISTEREDADHD Course’,
‘item_id’ => $course_id,
‘quantity’ => 1,
‘subtotal’ => $obj->amount,
‘total’ => $obj->total
);

$order = learn_press_create_order();
$order->set_customer_note( ” );
$order->set_status( ‘lp-completed’ );
$order->set_total( $obj->total );
$order->set_subtotal( $obj->amount );
$order->set_user_ip_address( learn_press_get_ip() );
$order->set_user_agent( learn_press_get_user_agent() );
$order->set_created_via( ‘external’ );
$order->set_user_id( $myuser_id );
$order->save();
$order->add_item( $item );

$user->enroll($course_id, $order->id);
}
}
return $order_id;
}

 

?>

This is a unique website which will require a more modern browser to work! Please upgrade today!