Answer the question
In order to leave comments, you need to log in
Where is the ''woocommerce_variable_price_html'' filter and the like described?
Hi all. There was a task to change the standard output of the price in Woocommerce. Have a function
public function get_price_html( $price = '' ) {
$display_price = $this->get_display_price();
$display_regular_price = $this->get_display_price( $this->get_regular_price() );
$display_sale_price = $this->get_display_price( $this->get_sale_price() );
if ( $this->get_price() !== '' ) {
if ( $this->is_on_sale() ) {
$price = apply_filters( 'woocommerce_variation_sale_price_html', '<del>' . wc_price( $display_regular_price ) . '</del> <ins>' . wc_price( $display_sale_price ) . '</ins>' . $this->get_price_suffix(), $this );
} elseif ( $this->get_price() > 0 ) {
$price = apply_filters( 'woocommerce_variation_price_html', wc_price( $display_price ) . $this->get_price_suffix(), $this );
} else {
$price = apply_filters( 'woocommerce_variation_free_price_html', __( 'Free!', 'woocommerce' ), $this );
}
} else {
$price = apply_filters( 'woocommerce_variation_empty_price_html', '', $this );
}
return apply_filters( 'woocommerce_get_variation_price_html', $price, $this );
}
Answer the question
In order to leave comments, you need to log in
Hello.
Descriptions may or may not be available.
Reasoning logically:
woocommerce_variation_sale_price_html - to change the price with a discount
woocommerce_variation_price_html - to change the price
woocommerce_variation_free_price_html - to change the zero price
woocommerce_variation_empty_price_html - to change the unspecified price
woocommerce_get_variation_price_html - general filter, to change the output of the function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question