WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
How to Customise checkout fields (2 posts)

  1. furumachi
    Member
    Posted 1 year ago #

    I'd like to change the order of first name and last name fields.

    Default is First Name field + Last Name field.

    But my hope is Last Name field + First Name field.
    (In Japan we describe like this)

    I've read the Tutorial below but could not understand it.
    http://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-actions-and-filters/

    I would like to get more information.

    The point is;

    1) What name of the file(***.php) should I customise ?

    2) Where is the file ?

    3) How to customise the description in detail ?

    I am waiting for your answer.
    Thank you,

    http://wordpress.org/extend/plugins/woocommerce/

  2. terrytsang
    Member
    Posted 1 year ago #

    Hi furumachi. If you like to change the order of first name and last name, there is a quick fix.

    1) Open your theme functions.php (located at wp-content/themes/[your-theme-name]/functions.php)

    2) Add below code at bottom section:

    // Hook in
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    function custom_override_checkout_fields( $fields ) {
    	$fields['billing']['billing_first_name']['class'] = array('form-row-last');
    	$fields['billing']['billing_last_name']['class'] = array('form-row-first');
    
    	return $fields;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic