- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All
I'm pretty new to developing Magento 2 (Been using Magento 1 for a while) and I want to make a slight change to the product page template.
The original folder/file structure is:
/vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
I copied this file, made my changes and uploaded it to:
/app/design/frontend/Magento/module-catalog/view/base/templates/product/price/final_price.phtml
Thinking this would override the original core file (not wanting to edit the original core file).
But there is obviously more to it as it doesn't seem to work.
Can anyone advise me please?
Many Thanks in Advance
Andy
PS Magento 2 was installed using composer if that makes any difference...
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Andy_Acute If you are using a third party theme then you have to create a child theme of Argento Stripes using the link mentioned in my previous message.
After creating child theme you have to copy the file inside app/design/frontend/vendorname/childthemename/Magento_Catalog/product/price/final_price.phtml
Let me know if you have any issue.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: small customise of product price template - not working
Hello @Andy_Acute
you need to copy that file into your theme
app/design/frontend/yourthemename/Magento_Catalog/templates/ then your path.
hope it will work for you.
if works then mark as solution.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: small customise of product price template - not working
@Andy_Acute You have to copy this file in your custom theme.
If you are running your theme then you can copy this file to app/design/frontend/themeVendor/yourthemename/Magento_Catalog/templates/product/price/final_price.phtml
If you don't have any custom theme then create a child luma theme using below link and then copy the file on the above path.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: small customise of product price template - not working
Thank you for your replies -
In my app/design/frontend/magento there are no files.
I want to customise the Magento core file final_price.phtml
So what is my themeVendor/yourthemename ??
Thank you
Andy
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: small customise of product price template - not working
So I created what I though was the correct structure and file system to override the 'final_price.phtml' file.
The original file is located at:
vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
I created the file structure for the amended file as:
app/design/frontend/Argento/Stripes/view/base/templates/product/price/final_price.phtml
I also created the files:
composer.json
registration.php
theme.xml
With the following content:
composer:
{ "name": "Argento/theme-frontend-Stripes", "description": "N/A", "require": { "php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0", "Argento/Stripes": "100.0.*", "magento/framework": "100.0.*" }, "type": "magento2-theme", "version": "100.0.1", "license": [ "OSL-3.0", "AFL-3.0" ], "autoload": { "files": [ "registration.php" ] } }
registration.php:
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::THEME, 'frontend/Argento/Stripes', __DIR__ );
theme.xml:
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <title>Stripes Child</title> <parent>Argento/Stripes</parent> <media> <preview_image>media/preview.png</preview_image> </media> </theme>
The theme I'm using and is selected in the Admin is 'Argento Stripes'.
I am obviously doing it wrong because the changes I made in the 'final_price.phtml' file are not showing when I clear the cache.
Can anyone advise me please?
Thank you
Andy
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: small customise of product price template - not working
@Andy_Acute Please copy the final_price.phtml on below path.
app/design/frontend/Argento/Stripes/Magento_Catalog/templates/product/price/final_price.phtml
Let me know if you stuck anywhere.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: small customise of product price template - not working
Hi Rahul
Thank you for your reply.
I moved the final_price.phtml file to app/design/frontend/Argento/Stripes/Magento_Catalog/templates/product/price folder and cleaned the cache but the amendment is till not showing.
I am using the code for composer.json, registration.php and theme.xml as posed above.
All these files are in the app/design/frontend/Argento/Stripes folder
Do you have any other ideas?
Thank you
Andy
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: small customise of product price template - not working
@Andy_Acute In your theme.xml you have mentioned the parent theme as Argento/Stripes.
And you are changing the files in the same folder.
So if you are using any custom theme and creating its child theme then use its name otherwise create a child theme of luma.
For this, in your theme.xml replace <parent>Argento/Stripes</parent> with <parent>Magento/luma</parent>.
In my previous message i have shared the link of how to create the child theme, you can refer that link.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: small customise of product price template - not working
Please let me explain better:
I have Magento Installed and I'm using a third party theme called Argento Stripes
All Magento core files are at:
public_html/vendor/magento
All third party theme files are at:
public_html/vendor/swissup
My public_html/app/design/frontend contains and empty folder called Magento
In my Magento Admin, my website is set to use the third party theme name 'Argento Theme'
So from this setup, I want to to modify the public_folder/vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
In Magento 1 to modify a core template all I had to do was mimic the folder structure public_html/app/design/frontend/argento/default/template/catalog/product/price.phtml
and this template would override the Magento core template.
I hope I've explained a little clearer.
Many Thanks for taking the time to reply.
Andy
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Andy_Acute If you are using a third party theme then you have to create a child theme of Argento Stripes using the link mentioned in my previous message.
After creating child theme you have to copy the file inside app/design/frontend/vendorname/childthemename/Magento_Catalog/product/price/final_price.phtml
Let me know if you have any issue.
Thanks