M
M
Maksym Davydchuk2017-07-03 15:18:22
css
Maksym Davydchuk, 2017-07-03 15:18:22

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 );
  }

The question is, where are filters described, such as 'woocommerce_get_variation_price_html', 'woocommerce_variation_empty_price_html' and the like in the example (search by filter name did not give anything)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-12-12
@AleksandrB

Prescribed for body.

body {
   min-width: 1201px;
   margin: 0 auto;
}

D
Denis Yanchevsky, 2017-07-03
@maksym1991

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 question

Ask a Question

731 491 924 answers to any question