Automatic update the cart on proceed to checkout is clicked

Automatic update the cart on proceed to checkout is clicked

September 20, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Automatic update the cart on proceed to checkout is clicked

Automatic Cart Update on “Proceed to Checkout” Click in Magento

Are you tired of your customers having to manually update their carts before proceeding to checkout in your Magento store? This unnecessary step can lead to abandoned carts and lost sales. Let’s explore how to automatically update the cart when the “Proceed to Checkout” button is clicked, making the buying process seamless for your customers.

The Default Magento Flow

By default, Magento requires users to click the “Update Cart” button before they can proceed to checkout. This manual step is designed to prevent unintended purchases. However, it also introduces friction in the checkout flow that can be reduced without compromising security.

Understanding the Update Cart Process

The “Proceed to Checkout” button in Magento triggers an event called checkout_cart_update_items. This event contains an observer responsible for updating the cart and redirecting the customer to the checkout page. To modify this behavior, we need to create a custom observer that intercepts this event.

Creating a Custom Observer

First, let’s create a new observer module in your Magento setup. The module should contain a configuration file and the observer class itself.

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_ModuleName>
            <active>true</active>
            <codePool>community</codePool>
            <setupVersion>2.4.5-p1</setupVersion>
        </Namespace_ModuleName>
    </modules>
    <events>
        <checkout_cart_update_items_after>
            <observers>
                <namespace_module_name_autocheckout>
                    <type>singleton</type>
                    <class>Namespace\ModuleName\Model\Observer</class>
                    <method>autoUpdateCart</method>
                </namespace_module_name_autocheckout>
            </observers>
        </checkout_cart_update_items_after>
    </events>
</config>

Implementing the Observer Method

Now, let’s implement the autoUpdateCart method in your observer class.

Observer.php

<?php

namespace Namespace\ModuleName\Model;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class Observer implements ObserverInterface
{
    public function execute(Observer $observer)
    {
        // This method gets triggered when the 'update_items_after' event is dispatched.
        // You can add your custom logic here, such as updating prices or quantity.

        // For our purpose, we simply return to bypass the default 'Update Cart' functionality.
        return $this;
    }
}

Bypassing the Update Cart Logic

By creating an empty autoUpdateCart method in the observer, we essentially pass through the event without performing any additional update operations. This allows Magento to redirect the customer directly to the checkout page when they click “Proceed to Checkout”, effectively bypassing the manual cart update step.

Conclusion: Streamlining the Checkout Process

Automatically updating the cart on “Proceed to Checkout” click simplifies the buying process for your customers, potentially reducing cart abandonment rates and increasing conversion. By leveraging Magento’s event system and creating a simple custom observer, you can achieve this functionality without altering core files or compromising security.

Remember that this modification is specific to Magento 2.x versions. If you’re using an older version, the event names might differ slightly in your configuration file.

For more advanced customizations and best practices in Magento development, consider exploring our Magento Development Services at Laravel Company. We specialize in delivering high-performing e-commerce solutions tailored to meet your business needs.

Checkout Security Extensions Themes

Our network