I am trying to Create my first custom extension. Unfortunately i think that i miss something.

In the magento 2 root directory i have the following files:




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Clud7_Skroutz" setup_version="1.0.0" />


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="clud7" frontName="skroutz">
            <module name="Clud7_Skroutz" />


namespace Clud7\Skroutz\Block;
class Success  extends \Magento\Framework\View\Element\Template
    public function getSomething()
        return 'returned something from custom block.';


<?xml version="1.0"?>
    <referenceContainer name="order.success.additional.info">
        <block class="Clud7\Skroutz\Block\Success"


<?php /* @var $block \Clud7\Skroutz\Block\Success */?>
<?php echo __('Custom template file content.'); ?>
<?php echo $block->getSomething(); ?>

My module is activated and also my magento 2 is compiled and cache cleaned. Also static content deployed.

  • What you want to do in success.phtml?
    – Ravi Soni
    Commented Jul 2, 2019 at 17:52
  • I want to display order id and to add few javascripts for product feed sale. My problem here is that i am unable even to display a single echo text command. Commented Jul 2, 2019 at 20:50
  • For that you can override success.phtml file in your custom theme you don't need to create extension for that..
    – Ravi Soni
    Commented Jul 3, 2019 at 3:17

2 Answers 2


You module code is correct. You have to need run command step by step and after you can place the order to check success page information.

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

php bin/magento cache:flush

For debug success page:

Temporarily you can debug checkout success page, to stop the checkout success page redirection after refresh page.

File path: magento/vendor/magento/module-checkout/Controller/Onepage/Success.php

Find the code and comment it:

// $session->clearQuote();

See below output of your module.

enter image description here


You need to override success.phmtl in to your custom theme. Don't need to create an extension for that

I have override success.phml file on my porto theme as follows


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.