• Resolved wdlyons

    (@wdlyons)


    Hi, I was wondering if within the PDF Invoices & Packing Slips for WooCommerce is possible to change the state name to the state code on the invoice and Packing Slip. For example Victoria to VIC, Western Australia to WA etc

    If so how do I go about doing so.

    • This topic was modified 2 years, 1 month ago by wdlyons.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @wdlyons,

    The places names are handled by WooCommerce directly, but you can override this using the woocommerce_states filter hook, like this:

    /**
     * WooCommerce:
     * Using abbreviations instead of complete names for Australian states
     */
    
    add_filter( 'woocommerce_states', function( $states ) { 
        $states['AU'] = array( // Australian states.
    		'ACT' => 'ACT',
    		'NSW' => 'NSW',
    		'NT'  => 'NT',
    		'QLD' => 'QLD',
    		'SA'  => 'SA',
    		'TAS' => 'TAS',
    		'VIC' => 'VIC',
    		'WA'  => 'WA',
    	);
        return $states;
    }, 10, 1 );
    Thread Starter wdlyons

    (@wdlyons)

    Thank You Yordan for your prompt reply. Much Apppreciated!

    I will give it a go.

    Cheers

    Warwick

    Thread Starter wdlyons

    (@wdlyons)

    Thanks again Yordan. Just wanted to let you know that worked perfectly. Much Appreciated!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @wdlyons,

    Thanks for confirming: I’m glad to hear that it worked!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘State abbreviation code’ is closed to new replies.