- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I added in admin some codes for the head section. This is working.
But I need at the success page, after checkout, another code in the head .. and only on this site.
How can I add this?
maybe edit the page:
vendor/magento/module-checkout/view/frontend/layout/checkout_onepage_success.xml?
Thank you!
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @hanhoe ,
Please add following code in your your theme's Magento_Checkout/layout/checkout_onepage_success.xml
<?xml version="1.0"?> <body> <referenceContainer name="order.success.additional.info"> <block name="order.success.extra.info" template="order/info.phtml" after="-"> </block> </referenceContainer> </body>
And then in your theme's Magento_Checkout/templates/order/info.phtml add your own code.
If you don't want to add the code in your custom theme than you can do it by creating a custom module. For that please refer the link https://magento.stackexchange.com/questions/136730/call-custom-phtml-on-success-page-without-overrid...
I hope this will works for you, if still you face any issue please let me know.
If it helps you, please accept it as solution.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Add in head own code
Yes, you need to edit same file which you mentioned.
In the layout file you need to specify where you want to add your custom script using referenceContainer or referenceBlock.
For more details please follow below link:
https://magento.stackexchange.com/questions/285753/how-can-i-add-google-ads-tracking-code-in-success...
I will suggest to override xml file into your current theme.
I hope it will help you!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @hanhoe ,
Please add following code in your your theme's Magento_Checkout/layout/checkout_onepage_success.xml
<?xml version="1.0"?> <body> <referenceContainer name="order.success.additional.info"> <block name="order.success.extra.info" template="order/info.phtml" after="-"> </block> </referenceContainer> </body>
And then in your theme's Magento_Checkout/templates/order/info.phtml add your own code.
If you don't want to add the code in your custom theme than you can do it by creating a custom module. For that please refer the link https://magento.stackexchange.com/questions/136730/call-custom-phtml-on-success-page-without-overrid...
I hope this will works for you, if still you face any issue please let me know.
If it helps you, please accept it as solution.
Regards.