Advertisement
Guest User

Untitled

a guest
Apr 15th, 2013
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. function custom_get_price_html_from_to( $price, $product ) {
  2. $from = $product->regular_price;
  3. $to = $product->get_price();
  4.  
  5. if ( $product->is_on_sale() )
  6. return ( ( is_numeric( $from ) ) ? woocommerce_price( $from ) : $from ) . ' <ins>' . ( ( is_numeric( $to ) ) ? woocommerce_price( $to ) : $to ) . '</ins>';
  7.  
  8. return '<del>' . ( ( is_numeric( $from ) ) ? woocommerce_price( $from ) : $from ) . '</del> <ins>' . ( ( is_numeric( $to ) ) ? woocommerce_price( $to ) : $to ) . '</ins>';
  9. }
  10.  
  11. add_filter( 'woocommerce_free_sale_price_html', 'custom_get_price_html_from_to', 10, 2 );
  12. add_filter( 'woocommerce_sale_price_html', 'custom_get_price_html_from_to', 10, 2 );
  13. add_filter( 'woocommerce_variable_free_sale_price_html', 'custom_get_price_html_from_to', 10, 2 );
  14. 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