Code hay

Code hiện giá thấp nhất của biến thể Woocommerce

Áp dụng:

Thay vì 400.000-500.000:

Sẽ hiện chỉ từ 400.000:

Chèn vào funtions.php của childtheme:

add_filter( 'woocommerce_variable_price_html', 'variation_price_format_min', 9999, 2 );
 function variation_price_format_min( $price, $product ) {
  $prices = $product->get_variation_prices( true );
  $min_price = current( $prices['price'] );
  $price = sprintf( __( 'Chỉ từ: %1$s', 'woocommerce' ), wc_price( $min_price ) );
  return $price;
}

 

Related Articles

Back to top button