• Resolved German Cabezas

    (@gercabace)


    Hi,

    I want to apply some formatting to address&shipping fields (uppercase, capitalize etc.)

    In checkout page I did it using “woocommerce_checkout_posted_data” hook but I’m not sure what hook to use on my account page to do the same changes.

    Could you help me?

    Many thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Remi Corson

    (@corsonr)

    Automattic Happiness Engineer

    Hi there,

    No need to run through hooks here, CSS will work, for instance:

    .woocommerce-billing-fields label[for=billing_first_name] {
    text-transform: uppercase;
    }
    Thread Starter German Cabezas

    (@gercabace)

    Thanks Remi for your answer.

    In my case, I need use hooks because I want to post formatted fields in the database.

    I have tried various hooks and found “woocommerce_process_myaccount_field_$KEY” which does what I need.

    In case someone else needs it, you have to replace $KEY by the name of field. By example, for capitalise “billing_first_name”:

    add_filter( 'woocommerce_process_myaccount_field_billing_first_name' , function ($value) { return mb_convert_case($value, MB_CASE_TITLE, "UTF-8"); } );

    Best Regards.

    Remi Corson

    (@corsonr)

    Automattic Happiness Engineer

    Hey,

    Excellent, thanks for sharing your solution.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Formatting address fields in account form’ is closed to new replies.