cancel
Showing results for 
Search instead for 
Did you mean: 

Add a configurable product to the cart,using the API Soap.

Add a configurable product to the cart,using the API Soap.

I need to add a configurable product to the cart,using the API Soap,but I always get the following error:
"Uncaught SoapFault exception: [1022]: Please specify the product required options"
The part of the code  that is the problem is the following:

 

$product = array(
            'product_id' => $product->getId(),
            'sku' => $product->getSku(),
            'qty' => 1,
          
           'options' => array(
        135 => '14',   //              135 is Id size attribute , 14 is id  my options (size ‘S’) 
    ),
            'bundle_option' => null,
            'bundle_option_qty' => null,
            'links' => null
        );
$productAdded = $proxy->shoppingCartProductAdd($sessionId,$quote->getId(),array($product),'1');

 

I also tried this way :

 

$product = array( 
'product_id' => $product->getId(), 
'sku' => $product->getSku(), 
'qty' => '1', 
'super_attribute' => 
array( 
0 => array( 
'key' => 135, 'value' => 14) 
), 
'bundle_option' => null, 
'bundle_option_qty' => null,
'links' => null );

$productAdded = $proxy->shoppingCartProductAdd($sessionId,$quote->getId(),array($product),'1');

End Also : 

 

$product = array( 
'product_id' => $product->getId(), 
'sku' => $product->getSku(), 
'qty' => '1', 
'super_attribute' => [
                   '135' =>'14' // attributeId => valueId
     ],

'bundle_option' => null, 
'bundle_option_qty' => null,
'links' => null );

$productAdded = $proxy->shoppingCartProductAdd($sessionId,$quote->getId(),array($product),'1');


I tried all solutions that I found online, but I always get the same error.
Could someone kindly explain to me what is the proper way to add an option to a configurable product using the "shoppingCartProductAdd ()" Soap API  v2?,

Thank you,
Have a nice day.

 

 

1 REPLY 1

Re: Add a configurable product to the cart,using the API Soap.

Hi @alexanderinaldi

 

 

Can you first verify how many custom options are set as "required" into the admin? You need to pass all those option values into the request. Because this error generally occures when there isn't any option value passed.

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now