shopp_customer_marketing()

set or get the marketing status for a customer.

shopp_customer_marketing (  $customer, $flag )

@param int $customer customer id to check or set
@param mixed $flag (optional default:null) null to return the marketing status, true to turn on marketing for a customer, false to turn off marketing for a customer
@return bool true if marketing accepted, false on failure and if marketing is not accepted.

Description

set or get the marketing status for a customer.

When a customer purchases from the store, their e-mail marketing preference can be specified on the checkout form, using the shopp(‘checkout’,’marketing’) theme api call, which creates a checkbox form element.

Example

// get the marketing preference of customer 2
if ( shopp_customer_marketing ( 2 ) ) {

    // get email address from Customer object 
    // using shopp('customer','get-email','mode=value')
    $to = shopp( shopp_customer(2), 'get-email', 'mode=value');
    $subject = 'My Marketing Message';
    $message = "Buy my products, or I'll keep sending you emails!";

    // get my merchant email address for the From address
    $headers = array('From' => shopp_setting('merchant_email'));

    // send my marketing email
    wp_mail( $to, $subject, $message, $headers );

}

See Also

You must be logged in to post a comment.

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

Skip to toolbar