Guest User

Untitled

a guest
Jan 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. function hoccodetot_wc_custom_get_price_html( $price, $product ) {
  2. if ( $product->get_price() == 0 ) {
  3. if ( $product->is_on_sale() && $product->get_regular_price() ) {
  4. $regular_price = wc_get_price_to_display( $product, array( 'qty' => 1, 'price' => $product->get_regular_price() ) );
  5. $price = wc_format_price_range( $regular_price, __( 'Free!', 'woocommerce' ) );
  6. } else {
  7. $price = '<span class="amount">' . __( 'Liên hệ', 'woocommerce' ) . '</span>';
  8. }
  9. }
  10. return $price;
  11. }
  12. add_filter( 'woocommerce_get_price_html', 'hoccodetot_wc_custom_get_price_html', 10, 2 );
Add Comment
Please, Sign In to add comment