WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WP E-commerce coupon code not working per item (8 posts)

  1. Skygirl
    Member
    Posted 2 years ago #

    Hi all, I'm setting up a WP E-commerce site and my coupons are *almost* working correctly... they apply the proper discount to the proper products (with conditions), the only trouble is that the discount will only be applied once even though I would like it to be a per-item discount if someone buys several of that item. Yes, "apply on all products" is checked.

    Any help is welcome, thank you!

  2. Justin Sainton
    Member
    Posted 2 years ago #

    Hi!

    Interesting - I tested out your theory. I created a coupon code called 'TEST'. Added a condition that the sub-total be under $1,000. Made sure it was applied to all products. Had the discount be $5. I added two different products to the cart, applied the coupon, and it took $10 off, as expected.

    --

    I just re-read your post - it's working per-product, but not per quantity per product. So if you have two different products, it's applied twice, regardless of whether or not you have 1 or 10 quantity of those products, right?

    Seems like a legitimate bug, see http://code.google.com/p/wp-e-commerce/issues/detail?id=894.

  3. Skygirl
    Member
    Posted 2 years ago #

    Hi Justin, thank you for checking that out. Yes, most all of our discounts are per product at the moment, so what I would like to see happen is that if the coupon is for $5 off an item, they get $50 off if they buy 10 of that item. Right now the coupon will only apply once ($5 off) no matter how many of that item are being purchased.

    Thanks again!

  4. Skygirl
    Member
    Posted 2 years ago #

    Just noticed another issue with coupons... they appear to be affecting tax on nontaxed items. For example: Say I have a product selling for $199 and marked not taxable. I add one of this item to my cart and go to check out. I see the correct amount on the checkout page, no tax, all good.

    I then apply a coupon for $50 off of that item. The discount works fine, but there is now a negative tax amount of $3.13 (as if it's a tax refund on the $50 discounted at the 6.25% tax rate). So essentially the system is refunding tax that was never charged in the first place.

    Not sure if this is a bug or something screwy in the settings, but any help is appreciated!

  5. Skygirl
    Member
    Posted 2 years ago #

    Ah ha... I win!

    Fix for negative tax with coupons:

    Commented out lines 89-98 in /wp-content/plugins/wp-e-commerce/wpsc-taxes/controllers/taxes_controller.class.php as follows

    // minus coupon tax if we are using coupons, but make sure the coupon is not a free shipping coupon
    				//if ($wpsc_cart->coupons_amount > 0 && ! $free_shipping){
    					//if ( $this->wpec_taxes_isincluded() )
    						//$coupon_tax = $this->wpec_taxes_calculate_tax($wpsc_cart->coupons_amount, $tax_rate['rate'], false);
    					//else
    						//$coupon_tax = $this->wpec_taxes_calculate_tax($wpsc_cart->coupons_amount, $tax_rate['rate']);
    					//$total_tax -= $coupon_tax;
    				//}

    Fix for coupon not applying to all items of that type:

    Added item quantity var to line 200, /wp-content/plugins/wp-e-commerce/wpsc-includes/coupons.class.php

    $return += $item->discount*$item->quantity;

  6. Skygirl
    Member
    Posted 2 years ago #

    I see the second fix I found matches what's going on in the code forum link you shared... great minds. :)

  7. Ncastro340
    Member
    Posted 1 year ago #

    I just want to say thank you for this: $return += $item->discount*$item->quantity;
    !!
    Did exactly what I needed and who knows how long it would've taken me to solve it.
    Thanks again for posting.

  8. Justin Sainton
    Member
    Posted 1 year ago #

    That's great news! For any others following this, please see this ticket in the code tracker -

    http://code.google.com/p/wp-e-commerce/issues/detail?id=894

    This issue (along with MANY others, as you'll see) has been resolved in the latest 3.8.9 release, which should be out within a few weeks.

Topic Closed

This topic has been closed to new replies.

About this Topic