How to “remove” file from parent theme

The child theme could just delete the parent theme file if it exists (via child theme functions.php). eg.

$template = get_template_directory().'/woocommerce.php'; 
if (file_exists($template)) {unlink($template);}

That would continue to override it if it came to exist again (ie. after a parent theme update.) If you aren’t going to update the parent theme just delete it’s woocommerce.php

If it’s a file other than the WooCommerce files and just another file in the parent theme, copy it into the child theme and remove it’s content just leave the <?php ?> tags if the content of the file is not needed.

Leave a Comment