AdminHooks.php
1 week ago
DefaultConversion.php
1 week ago
FlatRateShipping.php
5 years ago
FreeShipping.php
1 week ago
FrontEndHooks.php
1 week ago
LocalPickup.php
5 years ago
ShippingClasses.php
1 week ago
ShippingClassesMode.php
1 week ago
ShippingHooksFactory.php
1 week ago
ShippingMode.php
1 week ago
ShippingModeBase.php
1 week ago
ShippingModeProvider.php
1 week ago
UnsupportedShipping.php
1 week ago
VariableCost.php
1 week ago
DefaultConversion.php
16 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Multicurrency\Shipping; |
| 4 | |
| 5 | trait DefaultConversion { |
| 6 | public function getValueFromDefaultCurrency( $cost, $rateSettings, $costName, $currencyCode ) { |
| 7 | if ( preg_match( '/(.*)_' . $currencyCode . '$/', $costName, $matches ) ) { |
| 8 | $defaultCostName = $matches[1]; |
| 9 | if ( ! empty( $rateSettings[ $defaultCostName ] ) ) { |
| 10 | $cost = wcml_convert_price( $rateSettings[ $defaultCostName ], $currencyCode ); |
| 11 | } |
| 12 | } |
| 13 | return $cost; |
| 14 | } |
| 15 | } |
| 16 |