How do I change the templates in the cart or checkout?
Commerce uses Twig file-based templates for theming of the cart, checkout, and emails. The documentation has more in-depth information, but here's the basics.
- Create a new folder under
core/components/commerce/templates/
with a name of your choosing*. For examplemyawesomestore
ordesign2017
. The name of this folder is your theme name. - Edit the
commerce.theme
system setting and set it to the name of your theme. - Locate the template file you wish to edit (for example
default/frontend/checkout/cart.twig
) and copy it into your own theme folder with the same name and directory structure (for examplemyawesomestore/frontend/checkout/cart.twig
). Only copy the files you've actually changed - not the entire default directory! This way you can keep Commerce upgrades as simple as possible. - Edit your copied template.
Do not copy over all template files, just the ones you have edited.
* It's also possible to place the template folder somewhere else using the commerce.theme_path
setting. See the documentation for more detailed information about the possibilities for themes.
Learn more about templating in Commerce in the documentation.