2

How can I edit the {{var alertGrid|raw}} for the magento 2.2.x stock alert email?

I know the template is found in vendor\magento\module-product-alert\view\frontend\email\stock_alert.html but the template references the variable.

I want to remove the product price from the grid.

It appears to be defined here: M2 Product Alert Email, however, I don't see a straightforward way of editing the layout or removing the price.

Alternatively, I could remove the variable from the template, but how do I add back the product name and link to the product?

1 Answer 1

3

The alertGrid block is rendered using the template /view/frontend/templates/email/price.phtml from the Magento_ProductAlert module.
you can just copy this file to your theme keeping the same path and remove the price from it.
The price is rendered but the lines:

<?= $block->getProductPriceHtml(
                $_product,
                \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
                \Magento\Framework\Pricing\Render::ZONE_EMAIL,
                [
                    'display_label' => __('Price:')
                ]
            );
            ?>
2
  • Thanks. It seems /view/frontend/templates/email/stock.phtml is actually the most appropriate file to copy as I need to edit stock alerts, not price alerts.
    – RFI
    Commented Dec 14, 2018 at 12:06
  • I tried to override stock.phtml. However the local file text is not reflecting. Any insights?
    – Sejal Shah
    Commented Mar 31, 2020 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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