Last active
February 17, 2020 19:09
-
-
Save webdados/fac4cb326c88ef972130a3fafc37208b to your computer and use it in GitHub Desktop.
Remove Açores and Madeira pickup points from Portugal Chronopost Pickup network for WooCommerce and/or Portugal VASP Expresso Kios network for WooCommerce
This file contains 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 | |
//Uncomment next line to activate for Chronopost | |
//add_filter( 'cppw_available_points', 'remove_acores_madeira_pickup_points', 10, 2 ); | |
//Uncomment next line to activate for Chronopost | |
//add_filter( 'pvkw_available_points', 'remove_acores_madeira_pickup_points', 10, 2 ); | |
//The filter function | |
function remove_acores_madeira_pickup_points( $points, $postcode ) { | |
foreach ( $points as $key => $point ) { | |
$temp = explode( '-', $point['cod_postal'] ); | |
//Remove Azores and Madeira points | |
if ( intval( $temp[0] ) >= 9000 ) { | |
unset( $points[$key] ); | |
} | |
} | |
return $points; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment