• Hallo,
    I made several changes to Woocommerce single product page and packed them in a custom plugin. This plugin only contains code snippets, it does not enqueue any styles/js files.

    As I need this plugin only to be active on Single Product page, I wanted to use a MU-Plugin to enable it only on that specific page.
    But I am now wondering if this method would have any advantages (especially concerning performace) compared to if I’d just add my snippets to code snippets plugin, each wrapped in an if-statement (if (is_product()…).

    Which method would you recommend and why?
    Thank you and kind regards

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    It ultimately comes down to personal preference. Using an mu-plugin might have a very slight performance benefit over Code Snippets, simply because the file is directly included without needing Code Snippets as well. However, if you already have Code Snippets installed, the extra work needed to fetch and execute a few additional snippets is so small it would be unnoticable on most sites.

    If you want, you can always try out each method and use something like Query Monitor to measure and compare the results.

Viewing 1 replies (of 1 total)

The topic ‘General question about snippets & performance’ is closed to new replies.