skip to Main Content

I have a wordpress system with the plugin "WooCommerce".
A few days ago I modified a php file:
wp-content > plugins > WooCommerce > templates > single-product > price.php

after a update to the new WooCommerce version, my modification was override.
How can I solve this problem, that my modification is still available after a update

2

Answers


  1. Better option you need to create the child theme of your theme, then copy woocoomerce templates files paste in child theme directory. In future if you update themes and plugins your files and code will be safe inside theme.

    Login or Signup to reply.
  2. You can override your templates within your child-theme.

    In your case you can place your own price.php within child-theme/woocommerce/single-product/price.php

    If you are not sure about the path structure, woocommerce adds the needed path within the desired php file.

    In the woocommerce-plugin price.php you can see the following:

    <?php
    /**
    * Single Product Price
    *
    * This template can be overridden by copying it to yourtheme/woocommerce/single-product/price.php.
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search