Issues With Virtuemart Payment Methods and 100% Coupons


  • Default avatar
    simon82    
     5 years ago  last edited 5 years ago
    0

    We're running into a peculiar issue with coupons and the way they interact with the virtuemart payment methods.
    You see we have two payment methods we use: The first is Credit/Debit Card and the second is Free.

    When an Order is given a 100% discount through a coupon the payment method switch that should happen, the one from Credit/Debit to Free seems to fail instead, displaying "We are sorry, no payment method matches the characteristics of your order. Please.". If the coupon code is removed it becomes possible to actually pay using the Credit/Debit card payment method. If the order was free, to begin with with a product price of 0. The switch works as expected and the free payment method is used.

    This occurs with Virtuemart  3.6.010113, Joomla 3.9.11, and Awocoupon 3.5.7.1
  • Your avatar
    seyi    
     5 years ago  last edited 5 years ago
    0

    In testing, this seems to be an issue with Virtuemart.  I disabled AwoCoupon and got the exact same behavior with Virtuemart coupons.

    Here is a solution that worked, this is a hack of Virtuemart:
    in the file www/administrator/components/com_virtuemart/plugins/vmpsplugin.php, around line 930 is this:
    <?php
                
    if ($nb = (int)$this->checkConditions ($cart$method$cart_prices)) {

                    $nbMethod $nbMethod $nb;
                    $idName $this->_idName;
                    $method_ids[] = $method->$idName;
                } else {
                    unset($this->methods[$k]); 
                }
    ?>

    I commented out the else, like this:
    <?php
                
    if ($nb = (int)$this->checkConditions ($cart$method$cart_prices)) {

                    $nbMethod $nbMethod $nb;
                    $idName $this->_idName;
                    $method_ids[] = $method->$idName;
                } else {
                    //unset($this->methods[$k]);  # seyi_code COMMENT_OUT
                }
    ?>