php价格结算,php – WooCommerce – 覆盖现有结帐字段的结算状态和发布代码

我找不到通过计费状态和邮政编码的方式.

如何编辑现有结算字段的其他部分,如结算状态和发布代码?

这就是我在子主题的functions.php文件中所拥有的内容(我已经包含了影响计费部分的代码):

function my_custom_checkout_field( $checkout ) {

global $wpdb;

$check_zone = $wpdb->get_results("select area_name from brick_area where id='".$_SESSION['area']."'",ARRAY_A);

if(!empty($check_zone)){

$check_zoneid = $check_zone['0'];

}

woocommerce_form_field( 'my_field_name', array(

'type' => 'text',

'class' => array('my-field-class form-row-wide'),

'label' => __('Delivery Area'),

'placeholder' => __('Area'),

'readonly' =>'readonly',

'default' => $check_zoneid['area_name']

), $checkout->get_value( 'my_field_name' ));

woocommerce_form_field( 'my_expected_date', array(

'type' => 'text',

'class' => array('my-field-class form-row-wide'),

'required' => true,

'label' => __('Expected Delivery Date'),

'placeholder' => __('Enter expected delivery date.'),

), $checkout->get_value( 'my_expected_date' ));

/*woocommerce_form_field( 'my_expected_time', array(

'type' => 'text',

'class' => array('my-field-class form-row-wide'),

'required' => true,

'label' => __('Expected Delivery Time'),

'placeholder' => __('Enter expected delivery time.'),

), $checkout->get_value( 'my_expected_time' ));*/

woocommerce_form_field( 'site_contact_name', array(

'type' => 'text',

'class' => array('my-field-class form-row-wide'),

'required' => true,

'label' => __('Site Contact Person Name'),

'placeholder' => __('Enter site contact person name.'),

), $checkout->get_value( 'site_contact_name' ));

woocommerce_form_field( 'site_contact_phone', array(

'type' => 'tel',

'class' => array('my-field-class form-row-wide'),

'required' => true,

'label' => __('Site Contact Phone Number'),

'placeholder' => __('Enter site contact phone number.'),

), $checkout->get_value( 'site_contact_phone' ));

}

$fields['billing']['billing_city']['default'] = $_SESSION['cn'];

add_filter( 'woocommerce_default_address_fields' , 'custom_override_default_address_fields' );

function custom_override_default_address_fields( $address_fields ) {

// we are changing here billing_state field to required

$fields['billing']['billing_state']['required'] = true;

return $address_fields;

}

/*$fields['billing']['my_field_name']['default'] = $check_zoneid['area_name'];

$fields['billing']['my_field_name']['label'] = 'Area';*/

return $fields;

}

?>

谢谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值