Display Remove and Edit Item button in Order summary in Onepage Checkout page Magento2

Display Remove and Edit Item button in Order summary in Onepage Checkout page Magento2

August 26, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Display Remove and Edit Item button in Order summary in Onepage Checkout page Magento2

Display Remove and Edit Item Button in Order Summary in Onepage Checkout Page Magento2

As an experienced developer, I understand your need to add “Remove” and “Edit” buttons to the order summary section of the checkout page in Magento2. Let’s dive into resolving this issue step-by-step.

Understanding the Current Implementation

You’ve already made a commendable effort by adding the required HTML for the links in the details.html file under your vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.html path.

<div class="primary">
    <a data-bind="attr: {href: getConfigUrl($parent.item_id),title: $t('Edit item')}" class="action edit">
        <span data-bind="i18n: 'Edit'"&lt;/span&gt;
    </a>
</div>
<div class="secondary">
    <a href="#" data-bind="attr: {'data-post': getDataPost($parent.item_id),title: $t('Delete item')}" class="action delete">
        <span data-bind="i18n: 'Remove'"&lt;/span&gt;
    </a>
</div>

You’ve also updated the details.js file accordingly to handle the URL generation for both “Edit” and “Remove”.

getDataPost: function(itemId) {
    //...
    var mainlinkUrl = url.build('checkout/cart/delete/');
    //...
    obj.action = mainlinkUrl;
    obj.data.id= item.item_id;
    //...
}

getConfigUrl: function(itemId) {
    //...
    linkUrl = mainlinkUrl+"/id/"+itm_id+"/product_id/"+product_id;
    //...
}

The Current Issue and Resolution

The primary issue is with the url.build method. It seems you’re using the wrong URL for deleting an item from the cart.

In Magento2, to delete a quote item (which represents cart items), you should use the /checkout/cart/updatePost endpoint instead of delete/. The updatePost action handles both adding and removing items from the cart.

Change your getDataPost method as follows:

getDataPost: function(itemId) {
    //...
    var mainlinkUrl = url.build('checkout/cart/updatePost');
    //...
}

With this change, when you click on the “Remove” button, it will send a POST request to the /checkout/cart/updatePost endpoint with the item ID in the data.post attribute. This should properly delete the item from the cart.

Conclusion

Adding “Remove” and “Edit” buttons to the order summary section of the checkout page involves modifying both the HTML template file and the associated JavaScript component.

The key takeaway is understanding that Magento2 uses the /checkout/cart/updatePost endpoint for both adding and removing items, not a separate delete/ action. By updating your URL construction accordingly, you should now see the “Remove” button deleting items properly when clicked.

Remember to clear your cache after making these changes, as Magento2 heavily relies on caching for performance optimization.

For more in-depth guides on customizing Magento2’s checkout process, I highly recommend visiting Laravel Company where we provide comprehensive tutorials and best practices from a developer’s perspective.

Magento 2 Checkout Catalog Extensions

Our network