shopp_add_customer_address()

add or update an address for a customer

shopp_add_customer_address (  $customer, $data, $type )

@param int $customer (required) the customer id the address is added to
@param array $data (required) key value pairs for address, values can be keyed 'address', 'xaddress', 'city', 'state', 'postcode', 'country', 'geocode',  and 'residential' (residential added to shipping address)
@param string $type (optional default: billing) billing, shipping, or both
@return mixed int id for one address creation/update, array of ids if created/updated both shipping and billing, bool false on error

Description

add or update an address for a customer

shopp_set_customer_address() is an alias for shopp_add_customer_address().

Example

// get the current customer
$Customer = shopp_customer();

// Shipping Address
$shipping = array(
    'address' => '1 N Main Street',
    'xaddress' => 'Attn: John Doe',
    'city' => 'San Jose',
    'state' => 'CA',
    'country' => 'US',
    'postcode' => '95131',
    'geocode' => '',
    // flags shipping address as residential
    'residential' => true,
);

// set the shipping address
shopp_add_customer_address (  $Customer->id, $shipping, 'shipping' );

// Billing Address
$billing = array(   
    'address' => '1 N Main Street',
    'xaddress' => 'Attn: John Doe',
    'city' => 'San Jose',
    'state' => 'CA',
    'country' => 'US',
    'postcode' => '95131',
    'geocode' => ''
);

// set the billing address
shopp_add_customer_address (  $Customer->id, $billing, 'billing' );

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar