For example the function get_price_html_from_to()
in file plugins/woocommerce/includes/abstracts/abstract-wc-product.php
public function get_price_html_from_to( $from, $to ) {
return '<del>' . ( ( is_numeric( $from ) ) ? wc_price( $from ) : $from ) . '</del> <ins>' . ( ( is_numeric( $to ) ) ? wc_price( $to ) : $to ) . '</ins>';
}
Without going into the file itself and changing it, how do I alter that string?
Is it possible to create my own abstract-wc-product.php
file, and point wordpress/woo at the file instead of the original? or is there a way to simply remove & replace the function with one of my own? or just alter it’s string before it gets used?
One way i think you can make this work, is by declaring your new function
get_price_html_from_to( $from, $to )
before you includeabstract-wc-product.php
file.And then going in the
abstract-wc-product.php
file and adding this code near the function’sget_price_html_from_to( $from, $to )
definition :}
Though that requires you to go in the file and actually change it.. really slightly though.
Don`t change the templates as you will loose your changed once there is an update. Instead, add your method to the filter: