Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function custom_get_price_html_from_to( $price, $product ) {
- $from = $product->regular_price;
- $to = $product->get_price();
- if ( $product->is_on_sale() )
- return ( ( is_numeric( $from ) ) ? woocommerce_price( $from ) : $from ) . ' <ins>' . ( ( is_numeric( $to ) ) ? woocommerce_price( $to ) : $to ) . '</ins>';
- return '<del>' . ( ( is_numeric( $from ) ) ? woocommerce_price( $from ) : $from ) . '</del> <ins>' . ( ( is_numeric( $to ) ) ? woocommerce_price( $to ) : $to ) . '</ins>';
- }
- add_filter( 'woocommerce_free_sale_price_html', 'custom_get_price_html_from_to', 10, 2 );
- add_filter( 'woocommerce_sale_price_html', 'custom_get_price_html_from_to', 10, 2 );
- add_filter( 'woocommerce_variable_free_sale_price_html', 'custom_get_price_html_from_to', 10, 2 );
- add_filter( 'woocommerce_variable_sale_price_html', 'custom_get_price_html_from_to', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement