---
title: "How to Change Cross-Sell Product Limit in Magento 2?"
url: "https://magecomp.com/blog/change-cross-sell-product-limit-magento-2/"
date: "2023-02-27T13:14:28+00:00"
modified: "2025-02-14T09:37:02+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 373
reading_time: "2 min read"
summary: "Hello Magento Friends,"
description: "The default number of cross-sell products displayed in a shopping cart is 4 in Magento 2. Learn How to Change Cross-Sell Product Limit in Magento 2."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "Magento 2: How to Programmatically Add Configurable Products to Cart"
    url: "https://magecomp.com/blog/magento-2-programmatically-add-configurable-products-to-cart/"
  - title: "Magento 2: How to Pass Multi-Dimensional Array as an Argument in GraphQL"
    url: "https://magecomp.com/blog/magento-2-pass-multi-dimensional-array-as-argument-in-graphql/"
  - title: "Top 4 Sales Motivation Magento Extensions to Boost your Ecommerce Sales"
    url: "https://magecomp.com/blog/top-4-sales-motivation-magento-extensions-boost-ecommerce-sales/"
---

# How to Change Cross-Sell Product Limit in Magento 2?

_Published: February 27, 2023_  
_Author: Dhiren Vasoya_  

![How to Change Cross-Sell Product Limit in Magento 2](https://magecomp.com/blog/wp-content/uploads/2023/02/How-to-Change-Cross-Sell-Product-Limit-in-Magento-2-1024x512.webp)

**Hello Magento Friends,**

Today I am here with another Magento solution on How to Change the Cross-Sell Product Display Limit in Magento 2?
[![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-1.webp)](https://magecomp.com/services/hire-magento-programmer/)

Cross-selling products are supplements of the products added to the shopping cart. In Magento 2, Cross-sell products will be displayed on the Shopping Cart page.
Learn [**How to Setup Cross-Sell Products in Magento 2**](https://magecomp.com/blog/setup-cross-sell-up-sell-and-related-products-in-magento-2/).
Also, [**Get Cross Sell Products Collection using Root Script in Magento 2**](https://magecomp.com/blog/get-cross-sell-products-collection-using-root-script-magento-2/).
In default Magento, only four Cross-sell products will be displayed on the cart page. If you want to increase or decrease the Cross-sell Product display limit on the cart page, you need to modify the core cross-sell.php file. Let’s understand deeply.
## Steps to Change Cross-Sell Product Limit in Magento 2:
**Step 1:** First, you must create a **di.xml** file in the path below.
**app/code/Vendor/Extension/etc/frontend/di.xml**

Then, add the code as follows.
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="MagentoCheckoutBlockCartCrosssell" type="VendorExtensionBlockCartCrosssell" />
</config>
```

**Step 2:** After that, you must create a **Block file** in the path below.
**app/code/Vendor/Extension/Block/Cart/Crosssell.php**

Now add the following code snippet.
```
<?php

namespace VendorExtensionBlockCart;

use MagentoCatalogInventoryHelperStock as StockHelper;

class Crosssell extends MagentoCheckoutBlockCartCrosssell
{
    public function __construct(
        MagentoCatalogBlockProductContext $context,
        MagentoCheckoutModelSession $checkoutSession,
        MagentoCatalogModelProductVisibility $productVisibility,
        MagentoCatalogModelProductLinkFactory $productLinkFactory,
        MagentoQuoteModelQuoteItemRelatedProducts $itemRelationsList,
        MagentoCatalogInventoryHelperStock $stockHelper,
        array $data = []
    ) {
        parent::__construct(
            $context,
            $checkoutSession,
            $productVisibility,
            $productLinkFactory,
            $itemRelationsList,
            $stockHelper,
            $data
        );

        $this->_maxItemCount = 7; // here set your product limit
    }
}
```

[![Magento Malware Removal](https://magecomp.com/blog/wp-content/uploads/2023/04/Magento-Malware-Removal-CTA-1.webp)](https://magecomp.com/magento-malware-removal.html)

**Step 3:** After that, run the below commands.
```
php bin/magento setup:di:compile
php bin/magento cache:flush
```

## Conclusion:
Hence, accordingly, you can update the number of cross-selling products displayed on the shopping cart page in Magento 2. If you have any difficulty implementing the above steps, let me know through the comment section without hesitation. I will be quick to revert you back with a proper solution. Moreover, share the tutorial with your friends and stay in the know for more.
[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-1.webp)](https://magecomp.com/magento-performance-optimization.html)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/change-cross-sell-product-limit-magento-2/](https://magecomp.com/blog/change-cross-sell-product-limit-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-09-29 07:39:51 UTC_  
