Problem with Hikashop and zero total carts


  • Default avatar
    bnrbranding    
     6 years ago
    0

    We are using AWO + Hikashop and we have a problem when the cart total is $0.00. Whether it's a 100% discount coupon or a gift certificate balance that covers the entire cost, the cart will display the credit card payment section. Since these are required fields the user must enter them to continue, but the transaction results in an invalid amount error.


    If we use a Hikashop coupon, the payment section does not display when the cart toal is $0.00. The Hikashop devs took a look and this is what they said -

    I see what's going on. The issue is that you're using AWOCoupon and not HikaShop coupons.
    And apparently, the way they add the coupons to the cart is too late in the cart loading process for HikaShop's payment method system to know that the price is 0.
    Basically, the payment method system in HikaShop sees the price before the coupon is applied and thus it doesn't work properly.
    I suppose that they must be using a trigger instead of another.
    I would recommend them to implement the trigger onAfterCartShippingLoad to add their coupon to the cart after the shipping is loaded, but before the payment is loaded. If they use the trigger onAfterFullCartLoad, the payment is already loaded when they add the coupon. It's still possible, but in that case, they have to unload the payment in the cart themselves when the total is 0.

    Basically, I would recommend to contact AWOCoupon about that issue and provide them with this message. That should help them understand what needs to be done for the coupon to work properly with the payment methods during the checkout.

    Can you check this out? It's causing issues with our cart and the ability to use gift certificates.

  • Your avatar
    seyi    
     6 years ago
    0

    Hi,

    What version of Hikashop is this?  I do not get this, when testing in 3.1.1, in either legacy checkout or ajax.

    Also how do you have checkout setup, in hikashop->configuration->checkout->checkout workflow
  • Default avatar
    bnrbranding    
     6 years ago
    0

    We are using the latest version 3.2.0.


    We have tried multiple checkout workflows with the coupon on step one and the payment on step 2, but it doesn't matter how we setup the workflow, $0.00 cart totals still show the payment sections. Currently here is how we have it setup -

    Guest checkout only

    Step 1 - Login, Address
    Step 2 - Payment, Coupon, Shipping, Cart, Status

    Just to make sure that the cart was at a $0.00 total before the payment plugin was called, we also tried this workflow -

    Step 1 - Login, Address, Coupon, Shipping
    Step 2 - Payment, Cart, Status

    This gave us the same result. I can send you a URL and admin credentials if you would like to see the admin setup yourself.

  • Your avatar
    seyi    
     6 years ago  last edited 6 years ago
    0

    Hello,

    I have just tested Hikashop 3.2.0 with the checkout flow you described, and its working fine for me.  I enter a gift certificate which zeros out the cart, the payment method disappears.

    Yes, can you send a private message with temp admin access, so I can compare configurations?

    Hello,

    Thanks for the access.  After doing some testing, I find that products without tax work fine, but products with tax do not.  After much investigating, I find that the totals sent into AwoCoupon are not yet rounded.  this causes the order total (at least for me locally) to be very close to 0, but not quite.  So for example, the total I was seeing was 0.0032...

    So a little rounding fixes the error for me.  Can you try this code, in the file:

    www/administrator/components/com_awocoupon/helpers/estore/hikashop/couponhandler.php, around line 348 is this:
    <?php
            $object
    ->total->prices[0]->price_value_without_discount_with_tax $object->total->prices[0]->price_value_with_tax;
            $object->total->prices[0]->price_value_without_discount $object->total->prices[0]->price_value;
            $object->total->prices[0]->price_value_with_tax -= $object->discount_value;
    ?>


    Right BEFORE that, add this
    <?php
            $object
    ->total->prices[0]->price_value round$object->total->prices[0]->price_value$round );
            $object->total->prices[0]->price_value_with_tax round$object->total->prices[0]->price_value_with_tax$round );
    ?>


    See if that fixes the issue.