Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Mage_Checkout

Module: Shopping Cart API

Resource: cart_customer

Method:
  • cart_customer.addresses (SOAP V1)
  • shoppingCartCustomerAddresses (SOAP V2)

Allows you to set the customer addresses in the shopping cart (quote).

Arguments:

TypeNameDescription
stringsessionIdSession ID
intquoteIdShopping cart ID
arraycustomerAddressDataArray of shoppingCartCustomerAddressEntity
stringstoreStore view ID or code (optional)

Return:

TypeNameDescription
booleanresultTrue if the address is set

The shoppingCartCustomerAddressEntity content is as follows:

TypeNameDescription
stringmodeMode: billing or shipping
stringaddress_idAddress ID
stringfirstnameCustomer first name
stringlastnameCustomer last name
stringcompanyCompany name
stringstreetStreet
stringcityCity
stringregionRegion
stringregion_idRegion ID
stringpostcodePost code
stringcountry_idCountry ID
stringtelephoneTelephone number
stringfaxFax number
intis_default_billingDefines whether the address is a default billing address
intis_default_shippingDefines whether the address is a default shipping address

Faults:
No Faults.

Examples

Request Example SOAP V1
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );

$arrAddresses = array(
	array(
		"mode" => "shipping",
		"firstname" => "testFirstname",
		"lastname" => "testLastname",
		"company" => "testCompany",
		"street" => "testStreet",
		"city" => "testCity",
		"region" => "testRegion",
		"postcode" => "testPostcode",
		"country_id" => "id",
		"telephone" => "0123456789",
		"fax" => "0123456789",
		"is_default_shipping" => 0,
		"is_default_billing" => 0
	),
	array(
		"mode" => "billing",
		"address_id" => "customer_address_id"
	)
);

$resultCustomerAddresses = $proxy->call(
	$sessionId,
	"cart_customer.addresses",
	array(
		$shoppingCartId,
		$arrAddresses,
	)
);
Request Example SOAP V2
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 
 
$sessionId = $proxy->login('apiUser', 'apiKey'); 
  
$result = $proxy->shoppingCartCustomerAddresses($sessionId, 10, array(array(
'mode' => 'billing',
'firstname' => 'first name',
'lastname' => 'last name',
'street' => 'street address',
'city' => 'city',
'region' => 'region',
'postcode' => 'postcode',
'country_id' => 'US',
'telephone' => '123456789',
'is_default_billing' => 1
)));   
var_dump($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));

$result = $proxy->shoppingCartCustomerAddresses((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'customerAddressData' => array(array(
'mode' => 'billing',
'firstname' => 'first name',
'lastname' => 'last name',
'street' => 'street address',
'city' => 'city',
'region' => 'region',
'postcode' => 'postcode',
'country_id' => 'US',
'telephone' => '123456789',
'is_default_billing' => 1
))));
var_dump($result->result);