Premium customers plugin for wp-e-commerce

A few days after finishing my first public WordPress Plugin wp-e-commerce-currency-helper I did another one…

Last week I released the first stable version of wp-ecommerce-role-discount.

A plugin for WPEC to give special discounts to special customers.

It adds a field to the products page to add a price for premium customers.

Some shop owners don’t want to add special prices to every single product, so I added another feature in version 1.1

The plugin creates a new coupon for WPEC when it is activated. This coupon is applied to the cart of all premium customers.

The shop administrator can use it to give a discount on products or free shipping.

Thanks for the auto apply coupon code to vkzawa who posted this useful piece of code in the forums

I modified it and attached it to the wpsc_before_shipping_of_shopping_cart hook

function applyCoupon(){
            if($this->isPremiumCustomer()) {
                $wspc_coupons = new wpsc_coupons($options['coupon_code']);
                $wpsc_cart->coupons_amount = $wspc_coupons->calculate_discount(); //Update the cart to include the discount amount.
add_action('wpsc_before_shipping_of_shopping_cart',array( &$this, 'applyCoupon'));