清除woocommerce中的结帐字段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了清除woocommerce中的结帐字段相关的知识,希望对你有一定的参考价值。

我正在尝试删除各种结帐字段中的自动加载的用户信息,但似乎无法找到任何方式来访问字段值。我已经尝试了以下清除格式化,删除,字段等,但我找不到任何东西显示如何只删除值。有谁知道如何访问这个?

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

function custom_override_checkout_fields( $fields ) {

$fields['billing']['billing_first_name']['placeholder'] = '';
$fields['billing']['billing_last_name']['value'] = '';
unset($fields['billing']['billing_company']);
return $fields;
}
答案

注册过滤器:

 add_filter( 'woocommerce_checkout_get_value' , 'clear_checkout_fields' );

添加此功能。所有字段都将为空。

 function clear_checkout_fields($input)
    {
        return '';
    }

以上是关于清除woocommerce中的结帐字段的主要内容,如果未能解决你的问题,请参考以下文章