如何在订单后清除woocommerce结帐字段?

问题描述:

下订单后,如何清除woocommerce中的chekcout字段,以便当注册客户下订单时,他/她必须再次填写该字段?如何在订单后清除woocommerce结帐字段?

只需要在你的子主题的functions.php中添加这一条线上

add_filter('woocommerce_checkout_get_value','__return_empty_string',10); 

您可以使用woocommerce_checkout_get_value过滤器清除字段,但每次页面加载时都会清除它们。

function clear_checkout_fields($input){ 
    return ''; 
} 
add_filter('woocommerce_checkout_get_value' , 'clear_checkout_fields');