I am facing an issue when adding product to a created cart, the product is added to the cart successfully so as the customer, but when I retrieve the cart info total shows always 0, here is steps that I have followed : 1. login to api 2. create an empty cart 3. set a "customer" user 4. add product to cart 5. add addresses to cart
Here is my code
// login info here
$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create' );
echo 'cart id '. $shoppingCartIncrementId;
// cart_customer.set - set a "customer" user
$customerAsGuest = array(
"customer_id" => 327,
"mode" => "customer"
);
$resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array( $shoppingCartIncrementId, $customerAsGuest) );
echo '<br>resultCustomerSet : '.$resultCustomerSet;
// **************************** cart_product.add****************************
$arrProducts = array(
array(
"sku" => "003",
"quantity" => 1,
"options" => array(
"subscription_type" => 8,
"subscription_start" => "30/11/2018",
"qty" => 1
)
)
);
$resultCartProductAdd = $proxy->call($sessionId,"cart_product.add", array($shoppingCartIncrementId, $arrProducts));
echo 'ProductAdd : '. $resultCartProductAdd;
// ______________________________________cart_customer.addresses_______________________________
$arrAddresses = array(
array(
"mode" => "shipping",
"firstname" => "testFirstname",
"lastname" => "testLastname",
"company" => "testCompany",
"street" => "testStreet",
"city" => "testCity",
"region" => "testRegion",
"postcode" => "testPostcode",
"country_id" => "MA",
"telephone" => "0123456789",
"fax" => "0123456789",
"is_default_shipping" => 0,
"is_default_billing" => 0
),
array(
"mode" => "billing",
"firstname" => "testFirstname",
"lastname" => "testLastname",
"company" => "testCompany",
"street" => "testStreet",
"city" => "testCity",
"region" => "testRegion",
"postcode" => "testPostcode",
"country_id" => "MA",
"telephone" => "0123456789",
"fax" => "0123456789",
"is_default_shipping" => 0,
"is_default_billing" => 0
)
);
$resultCustomerAddresses = $proxy->call($sessionId, "cart_customer.addresses",array($shoppingCartIncrementId,$arrAddresses));
echo '<br> adresse result : '. $resultCustomerAddresses;
// **************************** infos cart ****************************
$result = $proxy->call($sessionId, 'cart.info',$shoppingCartIncrementId);
var_dump($result);
I have found this post but it did resolve my issue: Cart total doesn't update after adding an item to the cart (using API) using Magento 1.9 CE
Here is the response that I get (info cart):
["store_id"]=> string(1) "0" ["created_at"]=> string(19) "2018-11-27 13:59:41" ["updated_at"]=> string(19) "2018-11-27 13:59:44" ["converted_at"]=> NULL ["is_active"]=> string(1) "0" ["is_virtual"]=> string(1) "0" ["is_multi_shipping"]=> string(1) "0" ["items_count"]=> string(1) "1" ["items_qty"]=> string(6) "1.0000" ["orig_order_id"]=> string(1) "0" ["store_to_base_rate"]=> string(6) "1.0000" ["store_to_quote_rate"]=> string(6) "1.0000" ["base_currency_code"]=> string(3) "MAD" ["store_currency_code"]=> string(3) "MAD" ["quote_currency_code"]=> string(3) "MAD" ["grand_total"]=> string(6) "0.0000" ["base_grand_total"]=> string(6) "0.0000" ["checkout_method"]=> string(8) "customer" ["customer_id"]=> string(3) "327" ["customer_tax_class_id"]=> string(1) "3" ["customer_group_id"]=> string(1) "7" ["customer_email"]=> string(13) "[email protected]" ["customer_prefix"]=> NULL ["customer_firstname"]=> string(11) "projet test" ["customer_middlename"]=> NULL ["customer_lastname"]=> string(11) "projet test" ["customer_suffix"]=> NULL ["customer_dob"]=> NULL ["customer_note"]=> NULL ["customer_note_notify"]=> string(1) "1" ["customer_is_guest"]=> string(1) "0" ["remote_ip"]=> NULL ["applied_rule_ids"]=> NULL ["reserved_order_id"]=> NULL ["password_hash"]=> NULL ["coupon_code"]=> NULL ["global_currency_code"]=> string(3) "MAD" ["base_to_global_rate"]=> string(6) "1.0000" ["base_to_quote_rate"]=> string(6) "1.0000" ["customer_taxvat"]=> NULL ["customer_gender"]=> NULL ["subtotal"]=> string(6) "0.0000" ["base_subtotal"]=> string(6) "0.0000" ["subtotal_with_discount"]=> string(6) "0.0000" ["base_subtotal_with_discount"]=> string(6) "0.0000" ["is_changed"]=> string(1) "1" ["trigger_recollect"]=> string(1) "0
here is the info about magento : magento version : 1.9 Soap api : version 1