Tin Tức

Nội dung được bảo vệ bởi DMCA.com

Hiện Thị Thành Liên Hệ Nếu Giá Bán 0 Đồng Trên Woocommerce

Đăng bởi Thuấn Blogspot vào lúc 15/04/2022

CÁCH HIỆN THỊ TỪ 0 ĐỒNG THÀNH LIÊN HỆ TRÊN WEBSITE WORDPRESS DÙNG PLUGIN WOOCOMMERCE


Copy mã bôi đỏ bên dưới và dán vào file funtion.php trong chỉnh sửa giao diện theme hoặc child theme.

 function luviet_wc_custom_get_price_html( $price, $product ) {

    if ( $product->get_price() == 0 ) {
        if ( $product->is_on_sale() && $product->get_regular_price() ) {
            $regular_price = wc_get_price_to_display( $product, array( 'qty' => 1, 'price' => $product->get_regular_price() ) );
  
            $price = wc_format_price_range( $regular_price, __( 'Free!', 'woocommerce' ) );
        } else {
            $price = '' . __( 'Liên hệ', 'woocommerce' ) . '';
        }
    }
    return $price;
}
add_filter( 'woocommerce_get_price_html', 'luviet_wc_custom_get_price_html', 10, 2 );

Nhận xét

Thiết kế website và blog bán hàng Luviet
HỖ TRỢ
www.luviet.com
icon icon icon