我想编辑WooCommerce结帐页面的帐单邮寄地址 . 我想编辑我的结帐页面的结算状态 . 我尝试在我的孩子主题中首先进行编辑 .
然后我尝试编辑class-wc-checkout.php文件:
// Billing address
$billing_address = array();
if ( $this->checkout_fields['billing'] ) {
foreach ( array_keys( $this->checkout_fields['billing'] ) as $field ) {
$field_name = str_replace( 'billing_', '', $field );
$billing_address[ $field_name ] = $this->get_posted_address_data( $field_name );
}
}
没有成功 . 我怎样才能做到这一点?
谢谢 .
1 回答
要 edit / create / remove / reorder checkout fields 我们可以使用这2个过滤钩子:
或者在特定情况下你需要使用
此处是结算和发货默认字段列表:
例如,要使 'billing_state' 字段成为必需:
每个字段都包含一个可以编辑的属性数组:
结帐字段分为4组:
运输领域
结算字段
帐户字段
订单字段(备注,评论)
参考文献:
Official: Customizing checkout fields using actions and filters
Reordering WooCommerce custom checkout fields
Reorder billing fields in WooCommerce Checkout template
How to reorder billing fields in WooCommerce Checkout template?