1

My Magento 2.2.6. My Payment methods work properly for product having weight but not Showing My Payment methods with virtual product or downloadable product had no weight, when checkout.

The error message is "No Payment Method available" when checkout[Show If Enable Cash On Delivery & Check / Money order displaying ]. But I configure right and working for product have weight or sample product.

virtual product or downloadable product no need shipping methods my custom payment methods not showing because my payment methods select shipping methods.

For More details issue as No Payment Method Available Virtual Product also our module

2
  • Can you please share console error on checkout? Commented Nov 26, 2018 at 7:16
  • Actually Cash On Delivery & Check / Money order displaying for virtual Product, All payment methods show for sample product.
    – matinict
    Commented Nov 26, 2018 at 7:47

2 Answers 2

0

Please check the function isAvailable() of the class Sslwireless\Sslcommerz\Model\Sslcommerz.php

As per the code, your payment method will not available if there is no shipping method. For virtual product or downloadable product only quote, no shipping carrier is available in magento.

I have updated the isAvailable function of the class Sslwireless\Sslcommerz\Model\Sslcommerz.php to check if quote contains only Virtual products and has not any Shipping Address then the isAvailable function will returns true and your Payment method will be shown on checkout page.

public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
{
    if ($quote === null) {
        return false;
    }
    if(!$quote->getIsVirtual() && isset($quote->getShippingAddress()->getShippingMethod())){
     return parent::isAvailable($quote) && $this->isCarrierAllowed(
        $quote->getShippingAddress()->getShippingMethod()
     );
    }else{
        return true;
    }
}
0

At last i Got my solution (May be Someone will be help)

return strpos($this->getConfigData('allowed_carrier'), $shippingMethod) !== false;

Change as return strpos($this->getConfigData('allowed_carrier'), $shippingMethod) !== true;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.