Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 删除默认签出表单_Php_Wordpress_Forms_Woocommerce_Checkout - Fatal编程技术网

Php 删除默认签出表单

Php 删除默认签出表单,php,wordpress,forms,woocommerce,checkout,Php,Wordpress,Forms,Woocommerce,Checkout,因为我对php不是很熟练,所以我尝试通过css删除woocommerce的默认表单(这样我就可以使用我的自定义字段)。 问题是,woocommerce在签出结束时仍然会给我错误,因为默认格式中需要一些文件 我已经添加了这段代码来忽略默认的签出表单,添加了一个插件(N-media),表单看起来很完美,但签出时什么都没有 function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_fi

因为我对php不是很熟练,所以我尝试通过css删除woocommerce的默认表单(这样我就可以使用我的自定义字段)。 问题是,woocommerce在签出结束时仍然会给我错误,因为默认格式中需要一些文件

我已经添加了这段代码来忽略默认的签出表单,添加了一个插件(N-media),表单看起来很完美,但签出时什么都没有

function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_email']);
unset($fields['billing']['billing_city']);
return $fields;
}

我希望永久删除它并继续使用我的自定义表单

感谢您的建议。

您可以覆盖核心字段使其成为您自己的状态

例如:

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
     $fields['order']['order_comments']['placeholder'] = 'My new placeholder';
     return $fields;
}

为什么不尝试使用操作和筛选器自定义签出字段?Woocommerce文档链接了解如何取消所有签出字段的设置并向签出中添加新表单。搜索是你最好的朋友:)请不要在评论中添加php代码,请用你正在使用的新源代码编辑你的问题。非常凌乱。对不起,我不是故意凌乱的;)