Hide Payment method Information when product price is zero in Magento

Hide Payment method Information when product price is zero in Magento

July 28, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Hide Payment method Information when product price is zero in Magento

Hiding Payment Method Information for Free Products in Magento

In your Magento store, you’re facing an issue where products with zero prices are displaying unnecessary payment method information during checkout. This can lead to confusion for customers and clutter the checkout process. In this post, we’ll guide you through hiding the “Payment Method Information” step when a cart contains free products.

Understanding the Checkout Process in Magento

By default, Magento follows a five-step checkout process:

  1. Shopping Cart Summary
  2. Shipping Information
  3. Shipping Method
  4. Payment Method Information (The problematic step)
  5. Order Review

When you have products with prices greater than zero in your cart, all these steps are displayed to allow customers to complete their purchase.

The Problem: Displaying Unnecessary Steps for Free Products

However, when a product has a zero price, the “Payment Method Information” is still displayed during checkout. This step becomes redundant and can even cause issues if customers try to proceed without selecting a payment method.

To resolve this issue, we need to implement a condition that skips or hides the “Payment Method Information” step whenever a free product exists in the cart.

How to Hide Payment Method Information for Free Products

We’ll achieve this by modifying the checkout process using an observer and a helper. Here’s a step-by-step guide:

Step 1: Create a Helper File

First, create a new file named Payment.php in your custom theme directory under app/code/Vendor/Module/Helper/.

<?php
namespace Vendor\Module\Helper;

class Payment extends \Magento\Framework\App\Helper\AbstractHelper
{
    public function isCartContainsFreeProducts()
    {
        $cart = $this->_cart->getQuote();
        foreach ($cart->getAllVisibleItems() as $item) {
            if ($item->getPrice() == 0 && $item->isQty()) {
                return true;
            }
        }

        return false;
    }
}

Step 2: Create an Observer File

Next, create a new file named HidePaymentForFreeProducts.php in your custom module directory under app/code/Vendor/Module/Observer/.

<?php
namespace Vendor\Module\Observer;

use Magento\Framework\Event\ObserverInterface;

class HidePaymentForFreeProducts implements ObserverInterface
{
    private $paymentHelper;
    private $checkoutSession;

    public function __construct(
        \Vendor\Module\Helper\Payment $paymentHelper,
        \Magento\Checkout\Model\Session $checkoutSession
    ) {
        $this->paymentHelper = $paymentHelper;
        $this->checkoutSession = $checkoutSession;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        if ($this->paymentHelper->isCartContainsFreeProducts()) {
            $this->checkoutSession->setNoPaymentMethod(true);
        }
    }
}

Step 3: Create a Configuration File

Finally, create a new file named etc/adminhtml/events.xml in your custom module directory.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/events.xsd">
    <event name="controller_action_predispatch_checkout_index_index">
        <observer name="hide_payment_for_free_products" instance="Vendor\Module\Observer\HidePaymentForFreeProducts" />
    </event>
</config>

Conclusion

By following these steps, you’ll successfully hide the redundant “Payment Method Information” step during checkout whenever your cart contains free products. This improves the user experience by removing unnecessary steps from the checkout process.

Remember to replace Vendor and Module with your actual vendor name in the file paths and class names.

For more information on customizing Magento’s checkout process, consider exploring Laravel Company’s guide on Magento development.

Checkout Catalog Extensions Orders

Our network