I need to make some custom changes on add to cart button and item prices, in Recently Viewed Products widget. For add to cart button, i need some custom php statement, And for prices i need old price to be displayed on discounted products

I tried to make some edits on:

  • vendor\magento\module-catalog\view\frontend\templates\product\widget\viewed\sidebar.phtml

  • vendor\magento\module-catalog\view\frontend\ui_component\widget_recently_viewed.xml

  • vendor\magento\module-catalog\view\frontend\templates\product\list.phtml

and few more ...

But when i made some changes, nothing seems to appear on page. Does anyone know where i can edit these elements, so the changes will be applicable for this widget only. Thanks


I have found the files where i can:

edit button:

  • vendor\magento\module-catalog\view\frontend\web\template\product\addtocart-button.html

    extended to ->

  • app\design\frontend\Vendor\theme\Magento_Catalog\web\template\product\addtocart-button.html

edit item elements srtucture:

  • vendor\magento\modulecatalog\view\base\web\template\product\list\listing.html

    extended to ->

  • app\design\frontend\Vendor\theme\Magento_Catalog\web\template\product\list\listing.html

add some javascript:

  • vendor\magento\module-catalog\view\frontend\templates\product\widget\viewed\sidebar.phtml

    extended to ->

  • app\design\frontend\Vendor\theme\Magento_Catalog\templates\product\widget\viewed\sidebar.phtml

  • You can enable template path hints from admin panel and check which templates are being used, once you know that make sure you make the changes by override in your custom theme and not in the core module.
    – Shireen N
    Commented Mar 21, 2018 at 13:51

1 Answer 1


Check the below 2 files and make changes accordingly to the "Add to cart" button



  • Thanks Shireen, unfortunately this didn't help. Same when i put it in child theme extension folders
    – gundra
    Commented Mar 21, 2018 at 14:20

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.