L
L
ligisayan2016-03-03 15:41:52
PHP
ligisayan, 2016-03-03 15:41:52

How to redefine the data output sequence of a function?

Hello! There is a store on wordpress + woocommerce, in the file of which there is a standard function

public function get_price_html_from_to( $from, $to ) {
    $price = '<del>' . ( ( is_numeric( $from ) ) ? wc_price( $from ) : $from ) . '</del> <ins>' . ( ( is_numeric( $to ) ) ? wc_price( $to ) : $to ) . '</ins>';
    return apply_filters( 'woocommerce_get_price_html_from_to', $price, $from, $to, $this );
  }

displays the price like this:
<div class="price"><del><span class="amount">20.170 <ruble title="руб.">руб</ruble></span></del>
<ins><span class="amount">19.162 <ruble title="руб.">руб</ruble></span></ins></div>

Question: how to redefine the output sequence of ins and del in reverse order, if the function is redefined in this way?
add_filter( 'woocommerce_get_price_html', 'custom_price_html', 100, 2 );
function custom_price_html( $price, $product ){
...
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question