Last active
June 1, 2026 08:51
-
-
Save xlplugins/4ee8b2a912930f3bdbcea69cac879205 to your computer and use it in GitHub Desktop.
Hide free shippig reward for listed countries
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
| 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