WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Change 'state' to 'province' in ship (16 posts)

  1. torndownunit
    Member
    Posted 1 year ago #

    Is there a way to change 'state' to 'province' in the shipping calculator? The site only offers shipping and pickup with Canada. Thanks.

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

  2. hilmon
    Member
    Posted 1 year ago #

    check out class-wc-countries.php that's where all the location specific stuff is dealt with ... I haven't quite figured out how to hook into some of it yet tho ....

  3. torndownunit
    Member
    Posted 1 year ago #

    I should clarify, it does list Canadian provinces, but the title in the form field is "States", with a drop down of provinces. I am looking through that file, but so far I can't see anything. Thanks.

  4. hilmon
    Member
    Posted 1 year ago #

    line 831 .....

    'CA' => array('state'	=> array(
    'label'=> __('Province','woocommerce'),
    'placeholder'	=> __('Province', 'woocommerce')
    )
    ),

    But I think this is used only on the checkout page....

  5. WayLay Design
    Blocked
    Posted 1 year ago #

    I am looking to do this exact same thing with a Canadian client of ours. I was able to find the specific variable that controls this in plugins/woocommerce/woocommerce-template.php on line 1137.

    It shows <option value="">'.__( 'Select a state&hellip;', 'woocommerce' ) .'</option>'; where state&hellip is the variable. So while I can change this in the core file and it does work, I'd rather not do this for updating reasons. If there is a way to override this via functions.php that would be awesome.

  6. royho
    Member
    Posted 1 year ago #

    If there isn't already a filter for this, what you can do is use the PO file to translate it into "province". This way you're not modifying the core.

  7. hilmon
    Member
    Posted 1 year ago #

    Yeah, I've used this plugin to change some of the wording on the site ... works really well...

    http://wordpress.org/extend/plugins/codestyling-localization/

  8. WayLay Design
    Blocked
    Posted 1 year ago #

    Thanks for the tip hilmon. The plugin did the trick. Royho, we've never really dealt with PO or MO files until now. Learn something new everyday!

  9. hilmon
    Member
    Posted 1 year ago #

    We do indeed!! :-)

  10. FishFush
    Member
    Posted 1 year ago #

    Can installing that plugin slow anything down?

    I guess I don't get how it works, is it simply showing already existing language files, or is it loading new ones?

    I mean, for changing something small like this (just a few words), is it worth it? Or is it better to learn how to go down the manual PO/MO route (I'm very new to that, but curious).

    Thanks!

  11. zazu99
    Member
    Posted 12 months ago #

    I'd like to remove the "Select a State" option altogether. How do I do this

  12. genomq
    Member
    Posted 11 months ago #

    Add to functions.php in your theme this code:

    // Cut unnecessary fields
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    function custom_override_checkout_fields( $fields ) {
    unset($fields['billing']['billing_state']);
    return $fields;
    }

  13. zazu99
    Member
    Posted 11 months ago #

    Thanks I did this; however the drop down box for New Zealand provices and Australian States still appears

  14. genomq
    Member
    Posted 11 months ago #

    It's strange, maybe try in CSS hide this element:
    #billing_state {
    display: none;
    }

  15. zazu99
    Member
    Posted 11 months ago #

    Thanks I amended the states php file as suggested and that resolved my requirement

  16. TokerCoughin
    Member
    Posted 10 months ago #

    Hey All, I'm trying to do as the OP was. Change "Select a state" to be "Province" both in the checkout area, and on the cart page if possible.

    Can anybody offer some insight as to how to accomplish this ?

    Thanks in advance,

    Sincerely,

    Chris Fawkz Coffin

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.