Код: Выделить всё
add_filter('woocommerce_get_regular_price', array( $this, 'my_custom_price'), 99);
add_filter('woocommerce_get_price', array( $this, 'my_custom_price'), 99);
function my_custom_price( $original_price ) {
global $post, $woocommerce;
//Logic for calculating the new price here
$new_price = $original_price * 2;
//Return the new price (this is the price that will be used everywhere in the store)
return $new_price;
}
Код: Выделить всё
add_filter('woocommerce_get_variation_regular_price', array( $this, 'my_custom_price'), 99);
add_filter('woocommerce_get_variation_price', array( $this, 'my_custom_price'), 99);
Код: Выделить всё
add_filter('woocommerce_variation_prices_price', array( $this, 'my_custom_price'), 99);
Примечание: мне нужно, чтобы она действительно изменилась. , поэтому перехватчики отображения HTML не будут работать.
Я что-то упускаю или что-то не так?
Подробнее здесь: https://stackoverflow.com/questions/458 ... commerce-3