I want to get the all products and make changes in these product showing on the homepage enter image description here

2 Answers 2


This products are shown as widget in home-page-block cms block.

It is Catalog Product list widget, so you can configure Number of Products to Display, template, and wich products to show.

  • Thanks for your quick response.. I want make changes progmatically how to can I get these products??
    – Asad Khan
    Feb 12, 2019 at 8:32
  • What exactly changes do you want to do?design? Feb 12, 2019 at 8:36

You can do an override like this :


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\CatalogWidget\Block\Product\ProductsList">
        <plugin name="module_widget_override" type="YourNamespace\YourModule\Plugin\Block\Product\MyOverridePlugin" />



namespace YourNamespace\YourModule\Plugin\Block\Product;

class MyOverridePlugin
    die('IT WORKS')

If you want to modify the template , open the template path hints LINK . And override the template that is displaying thoses products.

I think this is the template:


Make the logic in this section

<?php if ($showWishlist || $showCompare || $showCart): ?>
                                    <div class="product-item-actions">
                                        <?php if ($showCart): ?>
                                            <div class="actions-primary">
                                                <?php if ($_item->isSaleable()): ?>
                                                    <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?>
                                                        <button class="action tocart primary" data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>">
                                                            <span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
                                                    <?php else: ?>
                                                            $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper');
                                                            $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()])
                                                        <button class="action tocart primary" data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>">
                                                            <span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
                                                    <?php endif; ?>
                                                <?php else: ?>
                                                    <?php if ($_item->getIsSalable()): ?>
                                                        <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div>
                                                    <?php else: ?>
                                                        <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div>
                                                    <?php endif; ?>
                                                <?php endif; ?>
                                        <?php endif; ?>
  • Thanks.. but what will I do to hide the "Add to Cart" on the Hot Sellers for the specific products
    – Asad Khan
    Feb 13, 2019 at 7:22
  • Updated my answer @AsadKhan Feb 13, 2019 at 8:28
  • Actually I'm not getting the Layout of the HotSeller to override it
    – Asad Khan
    Feb 13, 2019 at 13:55
  • @AsadKhan follow this link for more info oshansideas.blogspot.com/2016/11/… Feb 13, 2019 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.