Last active
April 7, 2022 09:23
-
-
Save wpfullstripe/226436a07574b40d8fdd794e98580c65 to your computer and use it in GitHub Desktop.
The fullstripe_billing_countries Wordpress filter
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 | |
/** | |
* A 'fullstripe_billing_countries' filter hook example for WP Full Stripe. | |
* It sets Spain as the only country offered in billing country dropdown on all forms. | |
* | |
* @param string $countryCodes Array of 2-letter ISO country codes returned by previous filters of the chain. | |
* @param array $params with the following keys: | |
* formName => Name of the form that requires the list of billing countries. | |
* formType => Type of the form that requires the list of billing countries. Possible values: | |
* inline_payment | |
* checkout_payment | |
* inline_subscription | |
* checkout_subscription | |
* inline_donation | |
* checkout_donation | |
* inline_save_card | |
* checkout_save_card | |
* | |
* @return string Filtered array of 2-letter ISO country codes | |
*/ | |
function getBillingCountries( $countryCodes, $params) { | |
$result = $countryCodes; | |
// Set Spain as the only billing country for every form | |
$result = [ 'ES' ]; | |
return $result; | |
} | |
add_filter('fullstripe_billing_countries', 'getBillingCountries', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment