从Woocommerce中的表单获取签出字段值
我的第一页是表单签出字段 我无法编辑此html,因此我使用inspect从Woocommerce中的表单获取签出字段值,woocommerce,Woocommerce,我的第一页是表单签出字段 我无法编辑此html,因此我使用inspect 因此,当我按下checkout时,它将显示checkout页面 但当我想支付订单时,它会显示如下 这是我的密码 add_filter( 'woocommerce_checkout_get_value' , 'custom_checkout_get_value', 20, 2 ); function custom_checkout_get_value( $value, $imput ) { // Billing
因此,当我按下checkout时,它将显示checkout页面
但当我想支付订单时,它会显示如下
这是我的密码
add_filter( 'woocommerce_checkout_get_value' , 'custom_checkout_get_value', 20, 2 );
function custom_checkout_get_value( $value, $imput ) {
// Billing first name
if(isset($_GET['mec_name']) && ! empty($_GET['mec_name']) && $imput == 'billing_first_name' )
$value = esc_attr( $_GET['mec_name'] );
// Billing phone
if(isset($_GET['mec_phone']) && ! empty($_GET['mec_phone']) && $imput == 'billing_phone' )
$value = esc_attr( $_GET['mec_phone'] );
// Billing email
if(isset($_GET['mec_email']) && ! empty($_GET['mec_email']) && $imput == 'billing_email' )
$value = sanitize_email( $_GET['mec_email'] );
return $value;
}