Coupons not being identified in shipping value calculation


  • Default avatar
    simon54    
     10 years ago
    0

    Hi

    we are using

    VP One page checkout
    Advance Shipping rules by Open tools

    we offer free shipping to UK customers when they spend a total of £30 (after discounts)

    if the order is above £30 (free shipping) and then a coupon is applied that lowers the total under £30 then FREE shipping is still given

    (we do not use a FREE SHIPPING coupon)

    when we debug the advance shipping rule there are no values given for any coupons in the basket, this is not being passed to the shipping calculation.

    does anyone know if this is an AWO coupon issue of and advance shipping rule issue.

    we switched off VP one page checkout and used regular virtuemart checkout and got same results.

    I really want to offer more coupons to customers but cannot afford to offer them if the shipping calcualtion does not work correctly

    here is an example from advance shipping rules showing no discount amounts in the varaibles after a coupon has been applied lowering the cart total to £26

    [articles] => 12
    [products] => 4
    [amount] => 29.99964
    [amountwithtax] => 29.99964
    [amountwithouttax] => 24.9997
    [baseprice] => 24.9997
    [basepricewithtax] => 29.99964
    [discountedpricewithouttax] => 24.9997
    [salesprice] => 29.99964
    [taxamount] => 4.99994
    [salespricewithdiscount] => 0
    [discountamount] => 0
    [pricewithouttax] => 24.9997
  • Your avatar
    seyi    
     10 years ago
    0

    Hello,

    Not sure why the shipping method is not finding the discount. But if you do not mind hacks, maybe you can tap into AwoCoupon directly at the point shipping rules pulls the information.

    Here is an example of pulling the AwoCoupon discount.
    <?php
        $coupon_discount 
    0;
        
    $session JFactory::getSession();
        
    $coupon_row $session->get('coupon''''awocoupon');
        if(!empty(
    $coupon_row)) {
            
    $coupon_row unserialize($coupon_row);
            
    $coupon_discount $coupon_row['product_discount'] + $coupon_row['shipping_discount'];
        }
    ?>


    In that example $coupon_discount would return the total discount, including tax savings.
  • Default avatar
    simon54    
     10 years ago
    0

    HI can you let me know what directory this piece of codes goes into please
  • Your avatar
    seyi    
     10 years ago
    0

    It would go into advanced shipping rules code. Cant be sure where exactly though. Wherever the object is set that holds the discountamount variable.
  • Default avatar
    OpenTools    
     10 years ago
    0

    Dear Seyi,
    I'm The developer of that shipping plugin (we already had contact a while ago). The reason, why the coupon discount is not available when shipping is first calculated, lies in the VM core: shipping plugins are called before coupon plugins. See also my response to the OPs message in my support forum: http://open-tools.net/forum/shipping-by-rules-plugin/4347-shipping-rule-when-product-discount-applied.html#5551

    Is the coupon discount already available before the coupon handler in the cart is called?

    Best regards,
    Reinhold
  • Your avatar
    seyi    
     10 years ago
    0

    Hi Reinhold,

    At the moment the customer enters the coupon and clicks save, the first time it is handled is when the virtuemart coupon handler calls it, unless it is an automatic coupon, then I believe it gets handled before. On all subsequent page relaods the discount data is available in a session. An example of how ot pull data from that session is posted in this thread already:
    https://awodev.com/forum/awocoupon/help-section/coupons-not-being-identified-shipping-value-calculation#comment-7544