Tin Tức

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

Dịch Trang Thanh Toán Woocommerce Sang Tiếng Việt Không Dùng Plugin

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

Đổi tên gọi và chú thích của trường dữ liệu trang thanh toán woocommerce 

(How to translate input field labels and placeholders in woocommerce checkout  page)

Dịch Trang Thanh Toán Woocommerce Sang Tiếng Việt Không Dùng Plugin


Bước 1: Truy cập Quản trị Wordpress - > Theme editor - > Chọn theme cần sửa -> funtions.php

Chú ý: chọn đúng theme hoặc child theme để sửa nhé, nhớ sao lưu code php trước khi sửa nha, không nếu có bị hỏng code thì có cái mà restore lại.

Bước 2: Tìm từng đoạn code như sau và dán sau thẻ <?php :


add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
function custom_override_checkout_fields($fields)
{

$fields['billing']['billing_company']['placeholder'] = 'Business Name';
$fields['billing']['billing_company']['label'] = 'Business Name';
$fields['billing']['billing_first_name']['placeholder'] = 'First Name';
$fields['shipping']['shipping_first_name']['placeholder'] = 'First Name';
$fields['shipping']['shipping_last_name']['placeholder'] = 'Last Name';
$fields['shipping']['shipping_company']['placeholder'] = 'Company Name';
$fields['billing']['billing_last_name']['placeholder'] = 'Last Name';
$fields['billing']['billing_email']['placeholder'] = 'Email Address ';
$fields['billing']['billing_phone']['placeholder'] = 'Phone ';
return $fields;
}
Giải thích: 
[billing] là trường ở form thanh toán
[shipping] là trường ở form nhận hàng.

['placeholder'] = 'Business Name'; là tên hiện thị trong ô nhập liệu
['label'] = 'Business Name'; là chữ hiện thị trên ô nhập liệu

Bạn chỉ cần thay thế các cừ tiếng anh sang ngôn ngữ cần thay thế là được.

Bước 3: Lưu lại và kiểm tra

Xem thêm:
- Hướng dẫn thêm hoặc ẩn các trường trong trang thanh toán woocommerce

Nhận xét

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