shopp_set_customer()

Update customer information for a given customer record

shopp_set_customer ( $customer, $data )

@param int $customer (required) The ID of the customer record to update
@param array $data (required) An associative array of customer data to update, including: wpuser, firstname, lastname, email, phone, company, marketing, type, saddress, sxaddress, scity, sstate, scountry, spostcode, sgeocode, residential, baddress, bxaddress, bcity, bstate, bcountry, bpostcode, bgeocode
@return bool|int returns false on failure, and the new customer id on success

Description

Update customer information for a given customer record

Example

// get the current user
$user = wp_get_current_user();

$data = array(
    // omit wpuser for non WP integrated
    // shopp accounts
    'wpuser' => $user->ID,

    'firstname' => "John",
    'lastname' => "Doe",
    'email' => $user->user_email,
    'phone' => '999-999-9999',
    'company' => 'My Company',
    'marketing' => 'no',
    // User defined customer type
    'type' => 'Tax-Exempt',

    // Shipping Address
    'saddress' => '1 N Main Street',
    'sxaddress' => 'Attn: John Doe',
    'scity' => 'San Jose',
    'sstate' => 'CA',
    'scountry' => 'US',
    'spostcode' => '95131',
    'sgeocode' => '',
    // flags shipping address as residential
    'residential' => true,

    // Billing Address
    'baddress' => '1 N Main Street',
    'bxaddress' => 'Attn: John Doe',
    'bcity' => 'San Jose',
    'bstate' => 'CA',
    'bcountry' => 'US',
    'bpostcode' => '95131',
    'bgeocode' => ''
);

// update the customer record and returns the id
$cid = shopp_set_customer( $user, $data);

See Also

You must be logged in to post a comment.

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

Skip to toolbar