-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
285e416
commit 49fd7fb
Showing
4 changed files
with
53 additions
and
2 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
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
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,45 @@ | ||
<?php | ||
/** | ||
* Handle integration with WooCommerce Multi-Currency | ||
* | ||
* @see https://woocommerce.com/products/multi-currency/ | ||
* @package Pay4Pay | ||
*/ | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
if ( ! class_exists( 'Pay4Pay_WOOCS' ) ) : | ||
|
||
/** | ||
* * Pay4Pay_WOOCS Class | ||
*/ | ||
class Pay4Pay_WOOCS { | ||
|
||
/** | ||
* Hook actions and filters | ||
*/ | ||
public static function init() { | ||
add_filter( 'woocommerce_pay4pay_charges_fixed', array( __CLASS__, 'get_converted_price' ) ); | ||
add_filter( 'woocommerce_pay4pay_charges_minimum', array( __CLASS__, 'get_converted_price' ) ); | ||
add_filter( 'woocommerce_pay4pay_charges_maximum', array( __CLASS__, 'get_converted_price' ) ); | ||
} | ||
|
||
/** | ||
* Return the gateway fee by the exchange rate. | ||
* | ||
* @param float $fee The gateway fee. | ||
*/ | ||
public static function get_converted_price( $fee ) { | ||
global $WOOCS; | ||
return $WOOCS->woocs_exchange_value($fee); | ||
} | ||
} | ||
|
||
// Check if integration exists. | ||
if (class_exists('WOOCS')) { | ||
Pay4Pay_WOOCS::init(); | ||
} | ||
|
||
endif; |
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