0

I have scoured the internet looking for a solution of removing the title word New Products that exists just above the grid from the Magento 2 new products content widget.

Not sure how to accomplish this. I've seen lots of information about changing xml templates but i'm not skilled enough in Magento to understand what they are saying.

2 Answers 2

1

You need to override vendor/magento/module-catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml in your custom theme at app/design/frontend/Vendor/theme/Magento_Catalog/templates/product/widget/new/content/new_grid.phtml and remove the title block/div present on line number 35.

<div class="block-title">
   strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong>
</div>
2
  • whats the location i copy this file to?
    – somejkuser
    Feb 3, 2019 at 19:00
  • @jkushner please refer updated answer.
    – Sejal Shah
    Feb 4, 2019 at 7:38
1

override items.phtml file from

vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml

to your theme

app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/list/items.phtml

Now, For title change you can replace New Products with your title in case 'new': like $title = __('Your Title');

case 'new':
    if ($exist = $block->getProductCollection()) {
        $type = 'new';
        $mode = 'grid';
        $type = $type . ' ' . $mode;

        $class = 'widget' . ' ' . $type;

        $image = 'new_products_content_widget_grid';
        $title = __('New Products'); //Change this to the title you want
        $items = $exist;

        $showAddTo = true;
        $showCart = true;
        $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
        $description = ($mode == 'list') ? true : false;
        $canItemsAddToCart = false;
    }
break;

and to remove it, just wrap lines 165 to 167 in if condition same as below,

<?php if($type != 'new'):?>
    <div class="block-title title">
        <strong id="block-<?php /* @escapeNotVerified */ echo $class?>-heading" role="heading" aria-level="2"><?php /* @escapeNotVerified */ echo $title; ?></strong>
    </div>
<?php endif; ?>

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.