• Resolved javorszky

    (@javorszky)


    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_include is hooked to from template_include to be woocommerce_locate_template instead? Or just forgoing the filtering and including the archive-product.php with wc_get_template on the onsale page?

    Best,
    Gabor

Viewing 1 replies (of 1 total)
  • Thread Starter javorszky

    (@javorszky)

    Actually don’t worry about it. I’ve looked into how WordPress and WooCommerce handles template changes, and will work around this.

Viewing 1 replies (of 1 total)

The topic ‘Load template by using WooCommerce’s functions’ is closed to new replies.