In this article, I show you how to customize WooCommerce template files for your custom project.
WooCommerce template files contain the markup and template structure for frontend and HTML emails of your store.
The main templates
archive-product.php
— the Template for displaying product archives, including the main shop page which is a post type archivecontent-product.php
— the template for displaying product content within loopscontent-product_cat.php
— the template for displaying product category thumbnails within loopscontent-single-product.php
— the template for displaying product content in the single-product.php templatecontent-widget-price-filter.php
— the template for displaying product price filter widgetcontent-widget-product.php
— the template for displaying product widget entriescontent-widget-reviews.php
— the template for displaying product widget entriesproduct-searchform.php
— the template for displaying product search formsingle-product.php
— the Template for displaying all single productssingle-product-reviews.php
— display single product reviews (comments)taxonomy-product_cat.php
— the Template for displaying products in a product category. Simply includes the archive templatetaxonomy-product_tag.php
— the Template for displaying products in a product tag. Simply includes the archive template
The template files related to display cart
cart/cart.php
— cart pagecart/cart-empty.php
— empty cart pagecart/cart-item-data.php
— cart item data (when outputting non-flat)cart/cart-shipping.php
— shipping methods displaycart/cart-totals.php
— cart totalscart/cross-sells.php
— show products that cross-sellcart/mini-cart.php
— contains the markup for the mini-cart, used by the cart widgetcart/shipping-calculator.php
— shipping calculatorcart/proceed-to-checkout-button.php
— contains the markup for the proceed to checkout button on the cart
The template files display the payment
checkout/cart-errors.php
– cart errors pagecheckout/form-billing.php
– checkout billing information formcheckout/form-checkout.php
– checkout Formcheckout/form-coupon.php
– show coupon form on the checkout pagecheckout/form-login.php
– show the login formcheckout/form-pay.php
– show pay for an order formcheckout/form-shipping.php
– shipping information formcheckout/payment.php
– payment sectioncheckout/payment-method.php
– output a single payment methodcheckout/review-order.php
– review order tablecheckout/thankyou.php
– display the thank page after paymentcheckout/terms.php
– checkout terms and conditions area
The templates display the elements on all pages of Woocommerce
global/breadcrumb.php
— show breadcrumbsglobal/form-login.php
— show login formglobal/quantity-input.php
— product quantity inputsglobal/sidebar.php
— show sidebarglobal/wrapper-end.php
— show the end portion of the structure elements surrounding the siteglobal/wrapper-start.php
— show the start portion of the structure elements surrounding the site
All the elements in the loop display products of Woocommerce
loop/add-to-cart.php
— the button add to the cartloop/loop-end.php
— the element end loop, each card only <ul>loop/loop-start.php
— the element start looploop/no-products-found.php
— displayed when no products are found matching the current queryloop/orderby.php
— show options for orderingloop/pagination.php
— show numbered pagination for catalog pagesloop/price.php
— show priceloop/rating.php
— show the rating productloop/result-count.php
— display the result count. Shows text: Showing x — x of x resultsloop/sale-flash.php
— display the label SALE word on product when the product is discounted
The templates display the account in Woocommerce
myaccount/dashboard.php
— shows the first intro screen on the account dashboardmyaccount/downloads.php
— shows downloads on the account pagemyaccount/form-add-payment-method.php
— add payment method form formmyaccount/form-edit-account.php
— Edit account formmyaccount/form-edit-address.php
— edit address formmyaccount/form-login.php
— login Formmyaccount/form-lost-password.php
— lost password formmyaccount/form-reset-password.php
— lost password reset formmyaccount/lost-password-confirmation.php
— lost password confirmation textmyaccount/my-account.php
— template display My Account pagemyaccount/my-address.php
— Template display My Addressmyaccount/my-downloads.php
— shows downloads on the account page (Deprecated)myaccount/my-orders.php
— shows orders on the account page (Deprecated)myaccount/navigation.php
— My Account navigationmyaccount/orders.php
— shows orders on the account pagemyaccount/payment-methods.php
— shows customer payment methods on the account pagemyaccount/view-order.php
— shows the details of a particular order on the account page
Product card
single-product/add-to-cart/external.php
— external product add to cart templatesingle-product/add-to-cart/grouped.php
— grouped product add to cart templatesingle-product/add-to-cart/simple.php
— simple product add to cart templatesingle-product/add-to-cart/variable.php
— variable product add to cart templatesingle-product/add-to-cart/variation-add-to-cart-button.php
— single variation cart button templatesingle-product/add-to-cart/variation.php
— single variation display templatesingle-product/tabs/additional-information.php
— additional Information tabsingle-product/tabs/description.php
— description tabsingle-product/tabs/tabs.php
— single product tabs templatesingle-product/meta.php
— show product meta data: article, categories, product tags in the product cardsingle-product/photoswipe.php
— photoswipe markupsingle-product/price.php
— show product pricesingle-product/product-attributes.php
— show product attributes. Used by list_attributes() in the products classsingle-product/product-image.php
— show product imagesingle-product/product-thumbnails.php
— show Product Thumbnailssingle-product/rating.php
— show product ratingsingle-product/related.php
— show related productssingle-product/review.php
— review comments templatesingle-product/review-meta.php
— the template to display the reviewers meta data (name, verified owner, review date)single-product/review-rating.php
— the template to display the reviewers star rating in reviewssingle-product/sale-flash.php
— sale Flash templatesingle-product/share.php
— product share template. Sharing plugins can hook into here or you can add your own code directlysingle-product/short-description.php
— product short description templatesingle-product/stock.php
— show product stocksingle-product/title.php
— show product titlesingle-product/up-sells.php
— product up-sells template
Templates for working with orders
order/form-tracking.php
— order tracking form templateorder/order-again.php
— show order again buttonorder/order-details-customer.php
— show Customer detailsorder/order-details-item.php
— show item detailsorder/order-details.php
— show order details tableorder/order-downloads.php
— order downloadsorder/tracking.php
— order tracking template
notices
— the folder which contains the templates display notification.
emails
— the folder which contains the templates displays the notification email.
How to edit files?
You have two upgrade-safe ways:
- Using hooks.
Each template file contains hooks with which you can change/add or remove content without editing the template files themselves. This method protects against upgrade issues, as the template files can be left completely untouched.
- Using overrides.
Copy the template into a directory within your theme named /woocommerce
keeping the same file structure but removing the /templates/
subdirectory.
For example:
To override the admin order notification, copy: woocommerce/templates/cart/cart.php
to wp-content/themes/yourtheme/
.woocommerce/cart/cart.php
The copied file will now override the WooCommerce default template file.
Thanks for your reading. If you have any question with this blog, don’t hesitate leave a comment.