woocommerce-帐单顺序字段随不同国家/地区而变化

我正在与woocommerce合作建立网上商店。我已经自定义了帐单邮寄地址字段的顺序。问题是, 某些国家/地区仍然显示不同的顺序。如何强制所有国家/地区的自定义订单?

编辑:

<?php
/*
 * Modifing the order of form fields.
 * More information here: http://www.trottyzone.com/change-order-of-woocommerce-fields-on-checkout-page/
 */
add_filter('woocommerce_checkout_fields', 'reorder_woo_fields');

function reorder_woo_fields($fields) {
    //move these around in the order you'd like
    $fields2['billing']['billing_first_name'] = $fields['billing']['billing_first_name'];
    $fields2['billing']['billing_last_name'] = $fields['billing']['billing_last_name'];
    $fields2['billing']['billing_email'] = $fields['billing']['billing_email'];
    $fields2['billing']['billing_company'] = $fields['billing']['billing_company'];
    $fields2['billing']['billing_address_1'] = $fields['billing']['billing_address_1'];
    $fields2['billing']['billing_postcode'] = $fields['billing']['billing_postcode'];
    $fields2['billing']['billing_city'] = $fields['billing']['billing_city'];
    $fields2['billing']['billing_country'] = $fields['billing']['billing_country'];
    $fields2['billing']['billing_state'] = $fields['billing']['billing_state'];
    $fields2['billing']['billing_phone'] = $fields['billing']['billing_phone'];

    $fields2['shipping']['shipping_first_name'] = $fields['shipping']['shipping_first_name'];
    $fields2['shipping']['shipping_last_name'] = $fields['shipping']['shipping_last_name'];
    $fields2['shipping']['shipping_email'] = $fields['shipping']['shipping_email'];
    $fields2['shipping']['shipping_company'] = $fields['shipping']['shipping_company'];
    $fields2['shipping']['shipping_address_1'] = $fields['shipping']['shipping_address_1'];
    $fields2['shipping']['shipping_postcode'] = $fields['shipping']['shipping_postcode'];
    $fields2['shipping']['shipping_city'] = $fields['shipping']['shipping_city'];
    $fields2['shipping']['shipping_country'] = $fields['shipping']['shipping_country'];
    $fields2['shipping']['shipping_state'] = $fields['shipping']['shipping_state'];
    $fields2['shipping']['shipping_phone'] = $fields['shipping']['shipping_phone'];

    //just copying these keeps the standard order
    $fields2['account'] = $fields['account'];
    $fields2['order'] = $fields['order'];

    return $fields2;
}

?>

#1


检查woocommerce class-wc-countries.php文件, 其中设置了语言环境。我认为你的问题可以通过以下代码解决

add_filter(‘woocommerce_get_country_locale’, ‘use_only_default_locale’);函数use_only_default_locale($ locale){return array(); }

编辑:

试试这个代码

add_filter( 'woocommerce_default_address_fields', 'my_default_address_fields' );
function my_default_address_fields( $fields ) {
  //move these around in the order you'd like
  $fields2['first_name'] = $fields['first_name'];
  $fields2['last_name'] = $fields['last_name'];
  $fields2['email'] = $fields['email'];
  $fields2['company'] = $fields['company'];
  $fields2['address_1'] = $fields['address_1'];
  $fields2['postcode'] = $fields['postcode'];
  $fields2['city'] = $fields['city'];
  $fields2['city']['label'] = 'City';
  $fields2['city']['placeholder'] = 'City';
  $fields2['country'] = $fields['country'];
  $fields2['state'] = $fields['state'];
  $fields2['phone'] = $fields['phone'];

  return $fields2;
}

注释掉add_filter(‘woocommerce_checkout_fields’, ‘reorder_woo_fields’);你需要稍微更改字段类以正确填充。


#2


通过使用woocommerce_checkout_fields过滤器, 你可以完全控制Checkout字段。

// 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 ) {
    //Minipulate the `$fields` vaiable and return it
    $fields['order']['order_comments']['placeholder'] = 'My new placeholder';
    return $fields;
}

请参阅文档以获取更多信息:http://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters

来源:

https://www.srcmini02.com/67557.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_36866.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?