I am trying to add product in to cart. I am facing lot of trouble with this. I have searched a lot of blogs. But could not find feasible answer.

I have also used the link in magento soap api v2 for adding product.

Every time i am getting error

Fatal error: Uncaught SoapFault exception: [1022] Please specify the product required option(s).

Pls give me a proper example that what are the input values should be there and what are their values..I am attaching my code here..

$proxy = new SoapClient('http://www.magentohost.com/api/v2_soap/?wsdl');
 $sessionId = $proxy->login('user', 'apikey'); 
 $resultCartId = $proxy->shoppingCartCreate($sessionId, '1');
$productList = $proxy->catalogProductList($sessionId);
$product = (array) $productList[0];
$product['qty'] = 1;
$product['product_id'] = '234';
$product['sku'] = 'xxxxxxxx';
$product['name'] = 'abcdefgh';
$product['description'] = 'abcdefgh';
$product['short_description'] = 'abcdefgh';
$product['weight'] = '123.0000';
$product['status'] = '1';
$product['url_key'] = 'ab_cd_ef';
$product['url_path'] = 'ab_cd_ef.html';
$product['visibility'] = '2';
$product['tax_class_id'] = '1';
$product['price'] = '899.0000';
$result = $proxy->shoppingCartProductAdd($sessionId, $resultCartId, array($product));
echo json_encode($result);
  • 1
    It looks like the product you are adding is either configurable or has some custom options. Have a look at the attributes you need to set on the product. – David Manners Apr 14 '15 at 7:27

you can add to cart a product. But product have some option and it's mandatory. so your item will not set in cart. so first check the option of the cart or add new simple product and check it.

| improve this answer | |

try this :

 $arrProducts = array(
                        "product_id" => $productId,
                        "qty" => $qty
Mage::getModel('checkout/cart_product_api')->add($quoteId,$arrProducts,$storeId) ;
| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.