2

I use Magento 2.0 for the first time and I am trying to make some changes on Checkout page. For example, I want to change template module-checkout/view/frontend/web/template/estimation.html, so I copied this template to my folder theme to 'Magento_Checkout/web/template/estimation.html' and I made some changes in it, but nothing changes. Also, for a test, I changed original template but still, no changes.

I use grunt, I deployed the code, cleared all cache. On every other pages, changes do apply, but not on checkout. Do you have any guess, what am I doing wrong?

Also a question - is there any better explanation on how does checkout page on Magento2 work than the one from Magento page?

7
  • you have to delete cache and regenerate static content php bin/magento setup:static-content:deploy & php bin/magento cache:clean Commented Sep 12, 2016 at 13:34
  • 1
    I did that - no changes.
    – Anitr
    Commented Sep 12, 2016 at 13:47
  • Please try opening the page in incognito/private window as the static content are also cached by browser. Commented Sep 12, 2016 at 13:51
  • For example in Chrome private window - changes now show. In Mozilla not, I cleared all cookies also, but still nothing.
    – Anitr
    Commented Sep 12, 2016 at 13:56
  • 1
    try deleting browser cache - support.mozilla.org/en-US/kb/how-clear-firefox-cache Commented Sep 12, 2016 at 13:58

3 Answers 3

12

In your case, the Browser Cache caused your issue, we should disable it when developing and testing.

Chrome Browser

enter image description here

Firefox

enter image description here

is there any better explanation on how does checkout page on Magento 2 work than the one from Magento page?

I'm not sure my explanation is good enough to understand.

We need to take a look: vendor/magento/module-checkout/view/frontend/layout/checkout_index_index.xml. We will see a lot of config nodes. Magento layout for one page checkout comes from here.

Navigate to vendor/magento/module-checkout/view/frontend/templates/onepage.phtml:

 <script type="text/x-magento-init">
        {
            "#checkout": {
                "Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
            }
        }
    </script>
    <script>
        window.checkoutConfig = <?php /* @escapeNotVerified */ echo \Zend_Json::encode($block->getCheckoutConfig()); ?>;
        // Create aliases for customer.js model from customer module
        window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn;
        window.customerData = window.checkoutConfig.customerData;
    </script>

The most logic is here. $block->getJsLayout() gets the config from the xml layout. The js Magento_Ui/js/core/app is in charge of the rendering UI. There are some global javascript variables. These variables are used for other js components.

For the js and html templates file, Magento will load them from pub/static. They are copied to pub/static after running static content deploy.

1
6

Follow below steps for view your changes

Delete var folder

Delete pub/static/

Run bellow commands for generate static content and clean cache.

php bin/magento setup:static-content:deploy

php bin/magento cache:clean

deleting browser cache

Now check your changes.

1
  • "Delete pub/static/" is not advisable. The pub/static/.htaccess is an important file necessary for cache and static files generation. Deleting this file will make you spiral down the "static files issue" hole and waste your evening.
    – Ejaz
    Commented May 20, 2022 at 12:40
0
bin/magento setup:upgrade && bin/magento cache:clean

command worked for me.

0

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.