How to increase cross-sell products display limit in magento 2?
You need to override Magento/Checkout/Block/Cart/Crosssell.php file.
Create Vendor/MyModule/etc/frontend/di.xml
<?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="Magento\Checkout\Block\Cart\Crosssell" type="Vendor\MyModule\Block\Checkout\Block\Cart\Crosssell" />
</config>
Create Vendor/MyModule/Block/Checkout/Block/Cart/Crosssell.php
namespace Vendor\MyModule\Block\Checkout\Block\Cart;
use Magento\CatalogInventory\Helper\Stock as StockHelper;
class Crosssell extends \Magento\Checkout\Block\Cart\Crosssell
{
public function __construct(
\Magento\Catalog\Block\Product\Context $context,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Catalog\Model\Product\Visibility $productVisibility,
\Magento\Catalog\Model\Product\LinkFactory $productLinkFactory,
\Magento\Quote\Model\Quote\Item\RelatedProducts $itemRelationsList,
StockHelper $stockHelper,
array $data = []
) {
parent::__construct(
$context,
$checkoutSession,
$productVisibility,
$productLinkFactory,
$itemRelationsList,
$stockHelper,
$data
);
$this->_maxItemCount = 8; //put ur limit here
}
}