DigiCommerce allows you to customize any of its template files through your WordPress child theme. This guide will walk you through the process of overriding plugin templates safely without modifying the original plugin files.
Why Use Child Theme Templates?
Using a child theme to customize DigiCommerce templates offers several advantages:
- Your customizations remain intact even after plugin updates
- Original template files stay unmodified, maintaining plugin stability
- Easy to revert changes by simply removing the customized template
- Keeps your customizations organized and separate from the plugin
How to Override DigiCommerce Templates
To customize DigiCommerce templates in your child theme, follow these simple steps:
Create the DigiCommerce Directory: First, create a new folder named ‘digicommerce’ in your child theme’s root directory. This folder will house all your customized template files.
Maintain the Original File Structure: When copying template files, it’s crucial to maintain the same directory structure as in the plugin.
For example:
- Plugin path:
wp-content/plugins/digicommerce/templates/checkout/payment-success.php
- Child theme path:
wp-content/themes/your-child-theme/digicommerce/checkout/payment-success.php
Copy and Customize Templates:
- Locate the template file you want to customize in the DigiCommerce plugin directory
- Create the corresponding folder structure in your child theme’s digicommerce directory
- Copy the template file to your child theme’s directory
- Make your desired modifications to the copied file
Example of Template Override: Let’s say you want to customize the payment success page:
- Original plugin location:
wp-content/plugins/digicommerce/templates/checkout/payment-success.php
- Create this path in your child theme:
wp-content/themes/your-child-theme/digicommerce/checkout/
- Copy
payment-success.php
to this new location and make your modifications
The child theme version will automatically take precedence over the plugin’s original template file.
Important Considerations:
- After DigiCommerce updates, review your customized templates for compatibility
- Only override templates that require customization
- Maintain the same file name and structure as the original template
By following these guidelines, you can safely customize DigiCommerce templates while ensuring your changes persist through plugin updates.