Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Last active June 1, 2026 08:51
Show Gist options
  • Select an option

  • Save xlplugins/4ee8b2a912930f3bdbcea69cac879205 to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/4ee8b2a912930f3bdbcea69cac879205 to your computer and use it in GitHub Desktop.
Hide free shippig reward for listed countries
add_filter( 'fkcart_free_shipping', function ( $options ) {
if ( is_null( WC()->cart ) ) {
return false;
}
$location = WC_Geolocation::geolocate_ip( '', true, true );
$country = ! empty( $location['country'] ) ? strtoupper( $location['country'] ) : '';
if ( 'AU' !== $country ) {
return false;
}
if ( false === $options ) {
$options = [];
}
return $options;
}, 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment