docs/theming/block-theme-development/theming-woo-blocks.md
Note: We're assuming you have some previous knowledge about block theme development and some WordPress concepts. If you are completely new to block theme development, please check Develop Your First Low-Code Block Theme to learn about block theme development, and explore the Create Block Theme plugin tool when you're ready to create a new theme.
WooCommerce comes with several block templates by default. Those are:
single-product.html)archive-product.html)
taxonomy-product_cat.html)taxonomy-product_tag.html)taxonomy-product_attribute.html)product-search-results.html)page-coming-soon.html)page-cart.html)page-checkout.html)order-confirmation.html)Block themes can customize those templates in the following ways:
/templates folder. For example, if a block theme contains a wp-content/themes/yourtheme/templates/single-product.html template, it will take priority over the WooCommerce default Single Product template.archive-product.html template but doesn't provide a taxonomy-product_cat.html template, the Products by Category template will use the archive-product.html template. Same for the Products by Tag and Products by Attribute templates.single-product-cap.html, that template will be used when rendering the product with slug cap. Similarly, themes can provide specific taxonomy templates: taxonomy-product_cat-clothing.html would be used in the product category with slug clothing.WooCommerce also comes with two specific block template parts:
mini-cart.html): used inside the Mini-Cart block drawer.checkout-header.html): used as the header in the Checkout template.Similarly to the templates, they can be overridden by themes by adding a file with the same file name under the /parts folder.
WooCommerce blocks rely on global styles for their styling. Global styles can be defined by themes via theme.json or by users via Appearance > Editor > Styles and offer several advantages over plain CSS:
For example, let's imagine you are building a theme and would like to customize the Product Price block styles, you can do so by adding these properties in your theme.json:
"styles": {
"blocks": {
"woocommerce/product-price": {
"color": {
"background": "#00cc00",
"text": "#fff"
},
"typography": {
"fontStyle": "italic",
"fontWeight": "700"
}
}
...
}
...
}
| Before | After |
|---|---|
You can find more documentation on global styles in developer.wordpress.org. You can also find the list of WooCommerce blocks and their names in the docs.