0

I am creating order programmatically for configurable product but not able to create order with color and size option. getting error "PHP Fatal error: Uncaught Error: Call to a member function getRealOrderId() on null in"

//configurable product id =5 , simple product id 3602, color attribute id=152, size attribute id is 153

 $tempOrder=[
    'currency_id'  => 'USD',
    'email'        => 'test@test.com', //buyer email id
    'shipping_address' =>[
           'firstname'    => 'test', //address Details
           'lastname'     => 'test',
           'street' => 'test street',
           'city' => 'California',
           'country_id' => 'US',
           'postcode' => '10019',
           'telephone' => '0123456789',
           'fax' => '2222',
           'save_in_address_book' => 1,
           'region' => 'California',
           'region_id' => '12', // State region id
                ],
  'items'=> [    ['product_id'=>'5','qty'=>2,'super_attribute' => array(152=>262,153=>6098)]
           ]
]; 
//do have helper function to create order reference link (https://www.rakeshjesadiya.com/how-to-create-order-programmatically-in-magento-2/)
$orderData = $helper->createMageOrder($tempOrder);
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.