Last active
June 29, 2018 17:23
-
-
Save YoshiYo/d55e2e86523b101d35ce72ca8f648518 to your computer and use it in GitHub Desktop.
This gist if for people who use WooCommerce and wants the hook to add a dropdown with french states at the checkout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add or modify States for France | |
* Description : Active the dropdown with all the french states without overseas departments. Copy/Paste in your functions.php in your child-theme. You need to have the plugin WooCommerce | |
* Version: 1.0 | |
* Author: Guillaume Forgue | |
* Author URI: http://guillaume-forgue.fr | |
*/ | |
/** | |
* Copyright (c) 2012 Guillaume Forgue. All rights reserved. | |
* | |
* Released under the GPL license | |
* http://www.opensource.org/licenses/gpl-license.php | |
* | |
* This is an add-on for WordPress | |
* http://wordpress.org/ | |
* | |
* ********************************************************************** | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* ********************************************************************** | |
*/ | |
add_filter( 'woocommerce_states', 'custom_woocommerce_states' ); | |
function custom_woocommerce_states( $states ) { | |
$states['FR'] = array( | |
'GE' => 'Grand Est', | |
'NA' => 'Nouvelle-Aquitaine', | |
'ARA' => 'Auvergne-Rhône-Alpes', | |
'BFC' => 'Bourgogne-Franche-Comté', | |
'BR' => 'Bretagne', | |
'CVDL' => 'Centre-Val de Loire', | |
'IDF' => 'Île-de-France', | |
'OC' => 'Occitanie', | |
'HDF' => 'Hauts-de-France', | |
'NO' => 'Normandie', | |
'PDLL' => 'Pays de la Loire', | |
'PACA' => 'Provence-Alpes-Côte d\'Azur', | |
'CR' => 'Corse', | |
); | |
return $states; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment