| 1 |
<?php namespace TierPricingTable\Integrations\Plugins; |
| 2 |
|
| 3 |
use TierPricingTable\PricingRule; |
| 4 |
|
| 5 |
class WooPaymentsMulticurrency extends PluginIntegrationAbstract { |
| 6 |
|
| 7 |
public function run() { |
| 8 |
add_filter( 'tiered_pricing_table/price/pricing_rule', function ( PricingRule $pricingRule ) { |
| 9 |
|
| 10 |
// Break if WooPayments MultiCurrency is not installed |
| 11 |
if ( ! class_exists( '\WCPay\MultiCurrency\MultiCurrency' ) ) { |
| 12 |
return $pricingRule; |
| 13 |
} |
| 14 |
|
| 15 |
if ( $pricingRule->isFixed() ) { |
| 16 |
$rules = []; |
| 17 |
|
| 18 |
foreach ( $pricingRule->getRules() as $quantity => $price ) { |
| 19 |
$rules[ $quantity ] = \WCPay\MultiCurrency\MultiCurrency::instance()->get_price( $price, 'product' ); |
| 20 |
} |
| 21 |
|
| 22 |
$pricingRule->setRules( $rules ); |
| 23 |
} |
| 24 |
|
| 25 |
return $pricingRule; |
| 26 |
|
| 27 |
}, 9999, 1 ); |
| 28 |
} |
| 29 |
|
| 30 |
public function getTitle(): string { |
| 31 |
return 'WooPayments Multicurrency'; |
| 32 |
} |
| 33 |
|
| 34 |
public function getAuthorURL(): string { |
| 35 |
return 'https://woocommerce.com/products/woocommerce-payments/'; |
| 36 |
} |
| 37 |
|
| 38 |
public function getIconURL(): string { |
| 39 |
return $this->getContainer()->getFileManager()->locateAsset( 'admin/integrations/woocommerce-develop.jpeg' ); |
| 40 |
} |
| 41 |
|
| 42 |
public function getDescription(): string { |
| 43 |
return __( 'Convert and display tiered pricing correctly when using WooPayments Multicurrency.', 'tier-pricing-table' ); |
| 44 |
} |
| 45 |
|
| 46 |
public function getSlug(): string { |
| 47 |
return 'woopayments-multicurrency'; |
| 48 |
} |
| 49 |
|
| 50 |
public function getIntegrationCategory(): string { |
| 51 |
return 'multicurrency'; |
| 52 |
} |
| 53 |
} |
| 54 |
|