Customizing WooCommerce Templates

When using the WooCommerce plugin with the Reign theme, you may want to customize the templates to fit your needs. This guide outlines how to override the WooCommerce template files within the Reign theme.

Overriding WooCommerce Templates

To override the WooCommerce templates, create the following directory structure within your theme and copy the corresponding files from the WooCommerce plugin.

Directory Structure

reign-child/
└── woocommerce/
    ├── archive-product.php
    ├── cart/
    │   ├── cart.php
    │   ├── cross-sells.php
    │   ├── mini-cart.php
    │   └── shipping-calculator.php
    ├── checkout/
    │   ├── form-checkout.php
    │   ├── form-coupon.php
    │   ├── form-login.php
    │   ├── payment.php
    │   └── thankyou.php
    ├── content-product.php
    ├── content-single-product.php
    ├── loop/
    │   ├── add-to-cart.php
    │   ├── orderby.php
    │   ├── pagination.php
    │   └── price.php
    ├── myaccount/
    │   ├── dashboard.php
    │   ├── form-edit-account.php
    │   ├── form-edit-address.php
    │   ├── form-login.php
    │   ├── form-lost-password.php
    │   └── my-orders.php
    ├── single-product/
    │   ├── add-to-cart/
    │   │   ├── external.php
    │   │   ├── grouped.php
    │   │   ├── simple.php
    │   │   ├── variable.php
    │   │   └── variation.php
    │   ├── price.php
    │   ├── product-attributes.php
    │   ├── product-image.php
    │   ├── product-thumbnails.php
    │   └── related.php

Steps to Override

  1. Copy the template files: Copy the desired template files from the WooCommerce plugin directory (wp-content/plugins/woocommerce/templates) to the corresponding directories in your theme.
  2. Customize the template files: Edit the copied template files in your theme to meet your customization requirements.

Example File Paths

  1. Archive Product Template:
    • Original Path: wp-content/plugins/woocommerce/templates/archive-product.php
    • New Path: reign-child/woocommerce/archive-product.php
  2. Cart Template:
    • Original Path: wp-content/plugins/woocommerce/templates/cart/cart.php
    • New Path: reign-child/woocommerce/cart/cart.php
  3. Checkout Form Template:
    • Original Path: wp-content/plugins/woocommerce/templates/checkout/form-checkout.php
    • New Path: reign-child/woocommerce/checkout/form-checkout.php
  4. Content Single Product Template:
    • Original Path: wp-content/plugins/woocommerce/templates/content-single-product.php
    • New Path: reign-child/woocommerce/content-single-product.php
  5. Loop Add to Cart Template:
    • Original Path: wp-content/plugins/woocommerce/templates/loop/add-to-cart.php
    • New Path: reign-child/woocommerce/loop/add-to-cart.php
  6. My Account Dashboard Template:
    • Original Path: wp-content/plugins/woocommerce/templates/myaccount/dashboard.php
    • New Path: reign-child/woocommerce/myaccount/dashboard.php
  7. Single Product Add to Cart Template:
    • Original Path: wp-content/plugins/woocommerce/templates/single-product/add-to-cart/simple.php
    • New Path: reign-child/woocommerce/single-product/add-to-cart/simple.php
  8. Single Product Price Template:
    • Original Path: wp-content/plugins/woocommerce/templates/single-product/price.php
    • New Path: reign-child/woocommerce/single-product/price.php

By following these steps, you can ensure that your customizations remain intact even when the WooCommerce plugin or the parent Reign theme is updated.

Update on May 22, 2024