[英]Does not work to rename the postal code and city label fields from WooCommerce
I tried for more then 3 hours to change and to remove the red star* from the postal code, but does not work here is my code in functions.php, using a child theme 我尝试了3个多小时来更改邮政编码,并从邮政编码中删除了红色星号*,但此处不起作用,这是我在function.php中使用子主题的代码
add_filter( 'woocommerce_checkout_fields', 'change_billing_codpostal_checkout' );
function change_billing_codpostal_checkout( $fields ) {
$fields['billing']['billing_postcode']['placeholder'] = 'Introduceti codul postal';
$fields['billing']['billing_postcode']['label'] = 'CodPostal';
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'change_billing_city_checkout' );
function change_billing_city_checkout( $fields ) {
$fields['billing']['billing_city']['placeholder'] = 'Adaugati Localitatea';
$fields['billing']['billing_city']['label'] = 'Localitate';
return $fields;
}
The placeholders from both works... and is showing me the well words 两种作品的占位符...并向我展示了好词
and for remove the require - is work but it still show me the red star and i want to display that.. 和删除要求-是工作,但它仍然显示我红星,我想显示它。
add_filter( 'woocommerce_billing_fields', 'wc_optional_billing_fields_camp', 20, 1 );
function wc_optional_billing_fields_camp( $fields ) {
$fields['billing_postcode']['required'] = false;
return $fields;
}
Also I want to rename the "Shipping" for checkout page with other word but doesnt work... 我也想用其他单词重命名结帐页面的“发货”,但是不起作用...
add_filter( 'gettext', 'customizing_checkout_text_shipping', 42, 3 );
function customizing_checkout_text_shipping( $translated_text_shipping, $untranslated_text_shipping, $domain )
{
if ( $untranslated_text_shipping == 'Shipping' && is_checkout() ) {
$translated_text_shipping = __( 'Transport', $domain );
}
return $translated_text_shipping;
}
try this hope this work 试试这个希望这项工作
add_filter( 'woocommerce_checkout_fields' , 'remove_postcode_validation', 99 );
function remove_postcode_validation( $fields ) {
unset($fields['billing']['billing_postcode']['validate']);
unset($fields['shipping']['shipping_postcode']['validate']);
return $fields;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.