WP-e-Commerce Adding A Product via Flash Button

this is a simple function that will add an item to the cart. you could tie this to an ajax call and pass whatever POST vars you want, obviously product id, quantity, etc..

function my_add_to_cart(){

    global $wpsc_cart;
    $product_id = 1;
    $args = array();
    $args['quantity'] = 1;
    $args['variation_values'] = null;
    $args['provided_price'] = null;
    $args['comment'] = null;
    $args['time_requested'] = null;
    $args['custom_message'] = null;
    $args['file_data'] = null;
    $args['is_customisable'] = false;
    $args['meta'] = null;
    $state = $wpsc_cart->set_item( $product_id, $args );

}

Leave a Comment