Want To Customize Fields in The Cart Page

This topic has 8 replies, 2 voices, and was last updated 2 months, 3 weeks ago ago by Will

  • Avatar: Will
    Will
    Participant
    September 10, 2025 at 12:04

    Hi, please see the screenshot.

    I want to remove the Company field in the cart page, and also want to change the text in the other fields.

    Let me know how can I do that?

    Thanks.

    Files is visible for topic creator and
    support staff only.
    7 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    September 10, 2025 at 14:39

    Hi @Will,

    Please add the following code under functions.php file locates in your child theme:

    
    function customize_woocommerce_checkout_fields( $fields ) {
        // Remove company field from billing only
        unset( $fields['billing']['billing_company'] );
        
        // Change street address placeholder text for billing
        if ( isset( $fields['billing']['billing_address_1'] ) ) {
            $fields['billing']['billing_address_1']['placeholder'] = 'Enter your street address';
        }
        
        // Change address line 2 placeholder text for billing
        if ( isset( $fields['billing']['billing_address_2'] ) ) {
            $fields['billing']['billing_address_2']['placeholder'] = 'Apartment, suite, unit, etc. (optional)';
        }
        
        return $fields;
    }
    add_filter( 'woocommerce_checkout_fields', 'customize_woocommerce_checkout_fields' );
    

    Hope it helps!

    Avatar: Will
    Will
    Participant
    September 10, 2025 at 19:16

    Hi Luca, please see the screenshot of my functions.php file.

    Could you point where exactly should I add the code?

    Thanks.

    Files is visible for topic creator and
    support staff only.
    Avatar: Justin
    Luca Rossi
    Support staff
    September 11, 2025 at 06:48

    Hi @Will,

    You put the custom codes after the line:

    
    add_filter(...
    

    Let us know how it goes!

    Avatar: Will
    Will
    Participant
    September 11, 2025 at 12:07

    Hello Luca,

    The Company field has been removed but the new place holder text in the Street Address fields do not show up.

    I have made the following changes in the place holder text..

    ———

    function customize_woocommerce_checkout_fields( $fields ) {
    // Remove company field from billing only
    unset( $fields[‘billing’][‘billing_company’] );

    // Change street address placeholder text for billing
    if ( isset( $fields[‘billing’][‘billing_address_1’] ) ) {
    $fields[‘billing’][‘billing_address_1’][‘placeholder’] = ‘House Number, Street Name, Colony Name’;
    }

    // Change address line 2 placeholder text for billing
    if ( isset( $fields[‘billing’][‘billing_address_2’] ) ) {
    $fields[‘billing’][‘billing_address_2’][‘placeholder’] = ‘Post Office, District etc.’;
    }

    return $fields;
    }
    add_filter( ‘woocommerce_checkout_fields’, ‘customize_woocommerce_checkout_fields’ );

    ————-

    But still the old place holder text is showing up instead of the new text.

    See the screenshot. What can I do to fix this?

    Files is visible for topic creator and
    support staff only.
    Avatar: Justin
    Luca Rossi
    Support staff
    September 12, 2025 at 06:04

    Dear Will,

    We would like to inform you that we have made some updates to the custom code. At your earliest convenience, could you please clear your cache and check the changes?

    You may refer to the following screenshot for reference:
    https://prnt.sc/t6Vk4DB7UGwa

    Thank you for your cooperation.

    Best regards,
    The 8Theme Team

    Avatar: Will
    Will
    Participant
    September 12, 2025 at 14:21

    Hi Luca,

    Thank you so so much.

    It is working now. Really appreciate your help!

    Avatar: Will
    Will
    Participant
    September 12, 2025 at 14:21

    Thanks for the support! My topic “Want To Customize Fields in The Cart Page” has been successfully resolved.

  • Viewing 8 results - 1 through 8 (of 8 total)

The issue related to '‘Want To Customize Fields in The Cart Page’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.