Load template by using WooCommerce’s functions
-
Hi,
I’m working on a site where the archive-product.php has been overridden by a plugin I wrote that’s slightly modified to do fragment caching. The site uses the plugin’s version of that template file, except for the on-sale page.
Your plugin however checks whether the file is present in the theme and then if it isn’t, defaults to the file that’s bundled with WooCommerce with no filter.
WooCommerce itself has a function for including templates:
wc_get_template, that would also go through the theme first, then WC, but it also has a filter which other plugins can use.Would you consider changing the hook
Woocommerce_onsale_page_Public::template_includeis hooked to fromtemplate_includeto bewoocommerce_locate_templateinstead? Or just forgoing the filtering and including the archive-product.php with wc_get_template on the onsale page?Best,
Gabor
The topic ‘Load template by using WooCommerce’s functions’ is closed to new replies.