This repository has been archived by the owner on Mar 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from nicobea/paypal-checkout-locale
Add a new Gateways class to handle the locale code of Paypal checkout
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the hyyan/woo-poly-integration plugin. | ||
* (c) Hyyan Abo Fakher <tiribthea4hyyan@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Hyyan\WPI; | ||
|
||
/** | ||
* Gateways | ||
* | ||
* Handle Payment Gateways | ||
* | ||
* @author Nicolas Joannès <nic@cobea.be> | ||
*/ | ||
class Gateways | ||
{ | ||
|
||
|
||
/** | ||
* Construct object | ||
*/ | ||
public function __construct() | ||
{ | ||
add_filter('woocommerce_paypal_args', array($this, 'setPaypalLocalCode')); | ||
|
||
} | ||
|
||
|
||
/** | ||
* Set the PayPal checkout locale code | ||
* | ||
* @param array $args the current paypal request args array | ||
* | ||
* @return void | ||
*/ | ||
public function setPaypalLocalCode($args) | ||
{ | ||
$lang = pll_current_language('locale'); | ||
$args['locale.x'] = $lang; | ||
|
||
return $args; | ||
|
||
} | ||
|
||
|
||
} |
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