Skip to content

Instantly share code, notes, and snippets.

@ablears
Last active August 17, 2020 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ablears/273b6107c502736c2b24bcdca87220d6 to your computer and use it in GitHub Desktop.
Save ablears/273b6107c502736c2b24bcdca87220d6 to your computer and use it in GitHub Desktop.
Add store locale to allowed country list in WooCommerce's Stripe plugin which whitelists countries since 4.5.1
function moso_add_country_to_stripe( $countries ) {
$wc_default_country = substr( get_option( 'woocommerce_default_country' ), 0, 2 );
if ( ! in_array( $wc_default_country, $countries ) ) {
$countries[] = $wc_default_country;
}
return $countries;
}
add_filter('wc_stripe_supported_countries', 'moso_add_country_to_stripe');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment