I need to display a static block to success page depending on the attribute-set of products in the order
Add block to order success page
attribute-setcheckout-pagemagento2.3
attribute-setcheckout-pagemagento2.3
I need to display a static block to success page depending on the attribute-set of products in the order
Best Answer
To fulfill your requirements, your can follow below steps and you need to use event observer.
app/code/StackExchange/Magento/Block/Checkout/Success.php
which is responsible for render content.Code
path like :
app/code/StackExchange/Magento/view/frontend/templates/custom-block.phtml
Code
Observer class path:
app/code/StackExchange/Magento/Observer/Frontend/Checkout/OnepageControllerSuccessAction.php
code
File path:
app/code/StackExchange/Magento/etc/frontend/events.xml
code
5.Last step to create a layout which is responsible for content to success page
File Path:
app/code/StackExchange/Magento/view/frontend/layout/checkout_onepage_success.xml
code