Factory.php
2 weeks ago
MulticurrencyHooks.php
2 weeks ago
OptionIterator.php
2 weeks ago
class-wcml-checkout-addons.php
2 weeks ago
MulticurrencyHooks.php
26 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Compatibility\WcCheckoutAddons; |
| 4 | |
| 5 | class MulticurrencyHooks implements \IWPML_Action { |
| 6 | |
| 7 | public function add_hooks() { |
| 8 | add_filter( 'option_wc_checkout_add_ons', [ $this, 'optionWcCheckoutAddOnsFilter' ] ); |
| 9 | } |
| 10 | |
| 11 | public function optionWcCheckoutAddOnsFilter( $optionValue ) { |
| 12 | $convertPrice = function( $index, $conf, $checkoutAddOnName, $checkoutAddOnId ) { |
| 13 | if ( |
| 14 | isset( $conf['adjustment'], $conf['adjustment_type'] ) |
| 15 | && 'fixed' === $conf['adjustment_type'] |
| 16 | ) { |
| 17 | $conf['adjustment'] = apply_filters( 'wcml_raw_price_amount', $conf['adjustment'] ); |
| 18 | } |
| 19 | |
| 20 | return $conf; |
| 21 | }; |
| 22 | |
| 23 | return OptionIterator::apply( $convertPrice, $optionValue ); |
| 24 | } |
| 25 | } |
| 26 |