小编Row*_*ouh的帖子

获取woocommerce 3中自定义结帐字段的值

在 Woocommerce 结帐中,我添加了一个自定义结帐字段,这是我的代码:

add_action( 'woocommerce_before_order_notes', 'shipping_add_select_checkout_field' );
function shipping_add_select_checkout_field( WC_Checkout $checkout ) {
    $options = array_merge( [ '' => __( 'Nothing to select' ), ], city_zone() );
    woocommerce_form_field( 'billing_country_zone', array(
            'type'     => 'select',
            'class'    => array( 'form-row-wide', 'address-field', 'update_totals_on_change' ),
            'label'    => __( 'City zone' ),
            'required' => true,
            'options'  => $options
    ), WC()->customer->billing_country_zone );
}
Run Code Online (Sandbox Code Playgroud)

现在我完全迷失了,因为我需要知道它的WC()->customer->billing_country_zone用途以及如何检查它的价值......

任何帮助都非常感谢。

php wordpress field checkout woocommerce

1
推荐指数
1
解决办法
8624
查看次数

标签 统计

checkout ×1

field ×1

php ×1

woocommerce ×1

wordpress ×1