Viewing 1 replies (of 1 total)
  • Thread Starter Tynez

    (@tynez)

    Solved replacing this code:

    <?php foreach ($checkout->checkout_fields['billing'] as $key => $field) : ?>
    <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
    <?php endforeach; ?>

    for this one:

    <?php
    // order the keys for your custom ordering or delete the ones you don't need
    $mybillingfields=array(
        "billing_first_name",
        "billing_last_name",
        "billing_company",
        "billing_address_1",
        "billing_address_2",
        "billing_city",
        "billing_state",
        "billing_postcode",
        "billing_country",
        "billing_email",
        "billing_phone",
    );
    foreach ($mybillingfields as $key) : ?>
    <?php woocommerce_form_field( $key, $checkout->checkout_fields['billing'][$key], $checkout->get_value( $key ) ); ?>
    <?php endforeach; ?>

    https://wordpress.stackexchange.com/questions/78339/how-to-reorder-billing-fields-in-woocommerce-checkout-template

    I dont know why but the original foreach dont work correctly

Viewing 1 replies (of 1 total)
  • The topic ‘form-billing.php error’ is closed to new replies.