2

I'm building a website with the "Neighborhood" Theme and WooCommerce. The site is quite large and is heavily customized and I have to set dozens of divs to not display or edit the text, which I'm using a large translation function for that uses multiple switch statements. As well as hooks for editing multiple woocommerce buttons. So my question is, is it better in regards to performance to hide all of these divs and use the function to edit text and redirections, or should I override multiple template files in woocommerce to make these changes?

1
  • I would go for the last, create a child theme, change the files needed with the according hooks. Even though hiding divs through css works for most cases you are still transmitting a certain amoubt of data to the browsers that is not needed..
    – funkysoul
    Commented Jul 26, 2017 at 19:42

1 Answer 1

1

The templates are, by definition, the mechanism to define how a certain woocommerce page would look, and child themes are, by definition, the way you change a behavior of a theme beyond what it allows for in the Admin UI.

Overriding the templates in a child theme is the best practice. (Bear in mind that this means you may have to come back and update the template when Woocommerce updates their templates.)

Also, changing the content in PHP is usually cheaper than letting the default PHP run then changing the content in the browser, because it duplicates work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.