Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hey guys can you please help me with something regarding the woocommerce plugin?

I want only these fields show up in the shipping section (i think it requires a reorder of the fields, but i don't know where to begin)

Name

Address 1

Adress 2

Email | Telephone

Company FIELD 1 | FIELD 2 (for the company details)

share|improve this question

closed as off-topic by kaiser Sep 12 at 10:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

Address fields are controlled by the WC_Countries class and can be filtered via:

$address_fields = apply_filters( 'woocommerce_' . $type . 'fields', $address_fields, $country );

where there are 2 $types: billing and shipping. Once you've found that it is just PHP array manipulation:

function reorder_shipping_fields( $address_fields ){

    if ( isset( $address_fields['shipping_company'] ) ){
        $shipping_company = $address_fields['shipping_company'];
        unset( $address_fields['shipping_company'] );
        $address_fields['shipping_company'] = $shipping_company;
    }

    return $address_fields;

}
add_filter( 'woocommerce_shipping_fields', 'reorder_shipping_fields' );
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.