{"id":3668873,"date":"2013-04-17T21:22:55","date_gmt":"2013-04-17T21:22:55","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/woocommerce-checkout-fields-width\/"},"modified":"2016-08-21T00:16:06","modified_gmt":"2016-08-21T00:16:06","slug":"woocommerce-checkout-fields-width","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/woocommerce-checkout-fields-width\/","title":{"rendered":"Woocommerce checkout fields width"},"content":{"rendered":"<p>Hello,<br \/>\nI am working with a Japanese website. I arranged the order of the checkout fields with something I found one of the posts:<\/p>\n<blockquote>\n<p>add_filter(&#8216;woocommerce_checkout_fields&#8217;,&#8217;reorder_woo_fields&#8217;);<\/p>\n<p>function reorder_woo_fields($fields) {<br \/>\n\t\/\/move these around in the order you&#8217;d like<\/p>\n<p>\t$fields2[&#8216;billing&#8217;][&#8216;billing_last_name&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_last_name&#8217;];<br \/>\n        $fields2[&#8216;billing&#8217;][&#8216;billing_first_name&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_first_name&#8217;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_company&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_company&#8217;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_address_1&#8217;] = $fields[&#8216;billing&#8217;][billing_address_1&#8221;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_address_2&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_address_2&#8217;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_city&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_city&#8217;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_postcode&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_postcode&#8217;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_country&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_country&#8217;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_state&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_state&#8217;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_email&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_email&#8217;];<br \/>\n\t$fields2[&#8216;billing&#8217;][&#8216;billing_phone&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_phone&#8217;];<\/p>\n<p>\t\/\/just copying these (keeps the standard order)<br \/>\n\t$fields2[&#8216;shipping&#8217;] = $fields[&#8216;shipping&#8217;];<br \/>\n\t$fields2[&#8216;account&#8217;] = $fields[&#8216;account&#8217;];<br \/>\n\t$fields2[&#8216;order&#8217;] = $fields[&#8216;order&#8217;];<\/p>\n<p>\treturn $fields2;<br \/>\n}<\/p>\n<\/blockquote>\n<p>The Japanese method follows a reversed order, so I changed above to:<\/p>\n<blockquote>\n<p>add_filter(&#8216;woocommerce_checkout_fields&#8217;,&#8217;reorder_woo_fields&#8217;);<\/p>\n<p>function reorder_woo_fields($fields) {<br \/>\n\t\/\/move these around in the order you&#8217;d like<\/p>\n<p>    $fields2[&#8216;billing&#8217;][&#8216;billing_last_name&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_last_name&#8217;];<\/p>\n<p>    $fields2[&#8216;billing&#8217;][&#8216;billing_first_name&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_first_name&#8217;];<\/p>\n<p>\t$fields2[&#8216;billing&#8217;][&#8216;billing_postcode&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_postcode&#8217;];<\/p>\n<p>\t$fields2[&#8216;billing&#8217;][&#8216;billing_state&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_state&#8217;];<\/p>\n<p>\t$fields2[&#8216;billing&#8217;][&#8216;billing_city&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_city&#8217;];<\/p>\n<p>\t$fields2[&#8216;billing&#8217;][&#8216;billing_address_1&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_address_1&#8217;];<\/p>\n<p>\t$fields2[&#8216;billing&#8217;][&#8216;billing_address_2&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_address_2&#8217;];<\/p>\n<p>\t$fields2[&#8216;billing&#8217;][&#8216;billing_email&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_email&#8217;];<\/p>\n<p>\t$fields2[&#8216;billing&#8217;][&#8216;billing_phone&#8217;] = $fields[&#8216;billing&#8217;][&#8216;billing_phone&#8217;];<\/p>\n<p>\t\/\/just copying these (keeps the standard order)<br \/>\n\t$fields2[&#8216;shipping&#8217;] = $fields[&#8216;shipping&#8217;];<br \/>\n\t$fields2[&#8216;account&#8217;] = $fields[&#8216;account&#8217;];<br \/>\n\t$fields2[&#8216;order&#8217;] = $fields[&#8216;order&#8217;];<\/p>\n<p>\treturn $fields2;<br \/>\n}<\/p>\n<\/blockquote>\n<p>I was able to rearrange but some fields overlapped, and the fields are not aligned to its ideal position.<\/p>\n<p>The rows now per line show as:<br \/>\n            last name<br \/>\nfirst name, postal code<br \/>\ntown\/city, state<br \/>\n(Address field overlapping or postal code field)<br \/>\nAddress 2,<br \/>\nEmail, Phone<\/p>\n<p>Thank you in advance for any help.<\/p>\n<p>https:\/\/wordpress.org\/extend\/plugins\/woocommerce\/<\/p>\n","protected":false},"template":"","class_list":["post-3668873","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3668873","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3668873\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3668873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}