•         $postdata = array(
              
               'payment_method' => 'bacs',
               'payment_method_title' => 'Direct Bank Transfer',
               'set_paid' => false,
               'billing' => array(
                 'first_name' => $name,
                 'last_name' => $surname,
                 'address_1' => '969 Market',
                 'address_2' => '',
                 'city' => 'Владимир',
                 'state' => 'Владимирская область',
                 'postcode' => '94103',
                 'country' => 'RU',
                 'email' => $user_data->user_email,
                 'phone' => '(555) 555-5555'
               ),
               'shipping' => array(
                 'first_name' => $name,
                 'last_name' => $surname,
                 'address_1' => '969 Market',
                 'address_2' => '',
                 'city' => 'Владимир',
                 'state' => 'Владимирская область',
                 'postcode' => '94103',
                 'country' => 'RU'
               ),
               'line_items' => array(
                 'product_id' => 42,
                 'quantity' => 1
               ),
               'shipping_lines' => array(
                'method_id' => 'flat_rate',
                'method_title' => 'Flat Rate',
                'total' => 10  
               ),
            );
            
            $order_data = $fswoocommerce->post('orders', $postdata);

    This piece of code is dropping an error:
    Error: Необходим ID или артикул заказа. [woocommerce_rest_required_product_reference]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce Rest Api dropping an Error’ is closed to new replies.