2

I need to add a class to the cart summary table caption.

I want to hide the caption by addding the class sr-only (bootstrap):

<caption class="table-caption sr-only" data-bind="text: $t('Total')"></caption>

The code is in the file ../Magento/Checkout/view/frontend/web/template/cart/totals.html

I created my own base template and <theme> is a child of this (aka I don't extend from empty or luma). So I override the file in app/design/frontend/<vendor>/<theme>/Magento_Checkout/web/template/cart/totals.html

I deployed static content, flushed the cache (in the browser too). So basically I did everything from this checked answer: https://magento.stackexchange.com/a/138238/42007 But my added class does not appear.

What did I miss?

3 Answers 3

5
  1. Check deploy mode, If deploy mode is not developer mode then set it.

    php bin/magento deploy:mode:set developer

  2. Check .htaccess is in pub/static/ folder or not. If not then please take from fresh magento and add it.

  3. Delete this file pub/static/frontend/<vendor>/<theme>/Magento_Checkout/web/template/cart/totals.html

  4. Deploy static content

rm -rf pub/static/*

rm -rf var/*

rm -rf var/view_preprocessed/*

php bin/magento setup:static-content:deploy

6
  • Thanks for you suggestions. I tried all of them but that didn't change the behavior. Although the file isn't at the path at 3.
    – steros
    Mar 10, 2017 at 7:15
  • But check my own answer. It was a caching problem. Only I don't know which cache. I even restarted the server and my computer without any luck. Today it just works...
    – steros
    Mar 10, 2017 at 7:16
  • Next time when you override .html file, If doesn't override then follow above steps. @4485670 Mar 10, 2017 at 7:27
  • yeah as I said I did, but it didn't work either. there must be some additional cache interfering.
    – steros
    Mar 10, 2017 at 7:31
  • To note: if in developer mode you shouldn't be deploying static-content at all. pub/static/frontend should be empty. Then it should be fetching everything on-the-fly. If you deploy any static content, then you'll have to manage that constantly as it will always use what's in pub/static in preference to your changes. Deploying static content should be reserved for Production mode only, as the notification will tell you! Dec 3, 2018 at 18:29
2

It was some caching bug. Cause after a night suddenly the correct template is loaded without any change. I only wish I knew which caching caused the problem. I did all the steps of calypso's answer btw.

1
  • Did you ever figure this out? I need to do the same but damned if I can find where it's getting this from. I wish there was a cache:[clean|flush]-the-bloody-lot command! Dec 3, 2018 at 18:32
0

You can also just go to

/pub/static

folder from your Magento root and then browse the path of any file that you wish to locate. In this case

pub/static/frontend/<Vendor>/<theme>/en_US/Magento_Checkout/template/cart

and then manually delete totals.html

After that go back to your browser and just refresh the page. The newest version of the deleted file will refresh into the static cache and you'll see all your latest changes.

This way there is no need to run

php bin/magento cache:flush 
rm -rf var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* pub/static/frontend/* 

Neither there is need to clear your browser caches.

This works great for both localhost and on server, in developer mode. In production mode, you'll need to selectively redeploy static resources.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.