mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Use GB
instead of UK
on disclaimers content by country
This commit is contained in:
parent
f49d748d5a
commit
3d7fb7fc53
2 changed files with 53 additions and 38 deletions
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Helper class to determine which disclaimer content should display based on shop location country.
|
|
||||||
*
|
|
||||||
* @package WooCommerce\PayPalCommerce\Button\Helper
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace WooCommerce\PayPalCommerce\Button\Helper;
|
|
||||||
|
|
||||||
class MessagesDisclaimers {
|
|
||||||
|
|
||||||
private $disclaimers = [
|
|
||||||
'US' => [
|
|
||||||
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/us/',
|
|
||||||
],
|
|
||||||
'UK' => [
|
|
||||||
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/uk/',
|
|
||||||
],
|
|
||||||
'DE' => [
|
|
||||||
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/de/',
|
|
||||||
],
|
|
||||||
'AU' => [
|
|
||||||
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/au/',
|
|
||||||
],
|
|
||||||
'FR' => [
|
|
||||||
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/fr/',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
public function link_for_country(): string {
|
|
||||||
$region = wc_get_base_location();
|
|
||||||
$country = $region['country'];
|
|
||||||
|
|
||||||
return $this->disclaimers[$country]['link'] ?? '';
|
|
||||||
}
|
|
||||||
}
|
|
53
modules/ppcp-button/src/Helper/class-messagesdisclaimers.php
Normal file
53
modules/ppcp-button/src/Helper/class-messagesdisclaimers.php
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Helper class to determine which disclaimer content should display based on shop location country.
|
||||||
|
*
|
||||||
|
* @package WooCommerce\PayPalCommerce\Button\Helper
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WooCommerce\PayPalCommerce\Button\Helper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MessagesDisclaimers
|
||||||
|
*
|
||||||
|
* @package WooCommerce\PayPalCommerce\Button\Helper
|
||||||
|
*/
|
||||||
|
class MessagesDisclaimers {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disclainers content by country.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $disclaimers = array(
|
||||||
|
'US' => array(
|
||||||
|
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/us/',
|
||||||
|
),
|
||||||
|
'GB' => array(
|
||||||
|
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/uk/',
|
||||||
|
),
|
||||||
|
'DE' => array(
|
||||||
|
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/de/',
|
||||||
|
),
|
||||||
|
'AU' => array(
|
||||||
|
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/au/',
|
||||||
|
),
|
||||||
|
'FR' => array(
|
||||||
|
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/fr/',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a disclaimer link based on country.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function link_for_country(): string {
|
||||||
|
$region = wc_get_base_location();
|
||||||
|
$country = $region['country'];
|
||||||
|
|
||||||
|
return $this->disclaimers[ $country ]['link'] ?? '';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue