WooCommerce is a great eCommerce platform for WordPress, but sometimes you may need to bypass its files. For example, if you’re using a caching plugin or service that isn’t compatible with WooCommerce, you may need to exclude WooCommerce’s files from being cached.
Or, if you’re making changes to your WooCommerce templates and don’t want those changes to be overwritten when you update the plugin, you may need to bypass the WooCommerce files. There are a few different ways to bypass WooCommerce’s files, and which one you use will depend on your particular situation.
1. Exclude WooCommerce’s Files from Being Cached
If you’re using a caching plugin or service that isn’t compatible with WooCommerce, you may need to exclude WooCommerce’s files from being cached. To do this, you’ll need to edit your .htaccess file and add the following lines of code:
# BEGIN Exclude WooCommerce
<FilesMatch "\.(wc-ajax|woocommerce|cart|my-account|checkout)\.php$">
Order Allow,Deny
Allow from all
</FilesMatch>
# END Exclude WooCommerce
2. Bypass WooCommerce Templates
If you’re making changes to your WooCommerce templates and don’t want those changes to be overwritten when you update the plugin, you can bypass the WooCommerce templates by adding the following code to your functions.php file:
add_filter( 'woocommerce_template_path', 'bypass_woocommerce_templates' );
function bypass_woocommerce_templates( $template ) {
$template = get_stylesheet_directory() . '/woocommerce/' . $template;
>
. You can also override template files by copying them into your theme’s /woocommerce/ directory.
>>
. If you plan on making lots of changes to WooCommerce templates, it’s a good idea to create a child theme.
.>
< P>. If you don’t want WooCommerce overriding any templates at all, you can add this line of code to your wp – config . php file: P>.
< P >< CODE > define ( ‘WC_TEMPLATE_PATH’ , ” ); CODE > P >
< B > 6. USE A PLUGIN . B >>
< P > There are also some plugins that can help with this: p >
– < a href = "https://WordPress.org/plugins/disable-wc-theme-updates/" Target = "_blank" > Disable WC Theme Updates a >
– < a href = "https://WordPress.org/plugins/woo-dont-override/" Target = "_blank" > WOO Don’t Override a >