Dokan don’t show orders for vendor
-
Hello!
Thanks for the nice plugin ??There is a question that i cannot solve. I’m developing a template and i’m using Dokan and Wocommerce. Everything works fine, except for one nuance.
Users create orders not through the standard woocommerce functionality, but through a modal window. The order itself is created via AJAX and the wc_create_order() function, then it is redirected to the payment system page. All this has already been implemented and almost works, but only showing the order to the vendor in his admin panel does not work. I tried to specify the status of the order as Completed and in Processing, but still the order is not credited to the vendor until i, as an administrator, enter the order and update it manually: https://prnt.sc/26ko7qr
Tried disabling all plugins, problem persistsMy code that creates the order
$email = "[email protected]"; $count = 1; $product_id = 24; $paymethod = 'lava'; if ($count <= get_product_count($product_id)) { $address = array( 'first_name' => '', 'last_name' => '', 'company' => '', 'email' => $email, 'phone' => '+', 'address_1' => '', 'address_2' => '', 'city' => '', 'state' => '', 'postcode' => '', 'country' => 'RU' ); $order = wc_create_order(); $order->add_product(wc_get_product($product_id), $count); $order->set_address($address, 'billing'); $order->set_address($address, 'shipping'); if ( WC()->cart->get_cart_contents_count() == 0 ) { WC()->cart->add_to_cart( $product_id ); } $order->set_created_via('programatically'); update_post_meta($order->get_id(), '_payment_method', $paymethod); update_post_meta($order->get_id(), '_payment_method_title', $paymethod); $order->calculate_totals(); $order->save(); $available_gateways = WC()->payment_gateways->get_available_payment_gateways(); $result = $available_gateways[$paymethod]->process_payment($order->get_id()); if ($result['result'] == 'success') { die($result['redirect']); } else { die('false'); } } else { die('false'); }
Why is it so, maybe it is for the dokan that you need to specify some parameters in the order?
- The topic ‘Dokan don’t show orders for vendor’ is closed to new replies.