Hi, @thanhtd, thanks for your quick feedback.
I used wmc_get_price() and it works fine, but I still have issues with a late double conversion, maybe an example can illustrate better:
Let’s say I have a WC shop, main currency €, and a secondary currency $, and 1€ = 1.2$. And a product in cart that costs 10€:
And the shipping rule: 1€ (always) + 10% of products price.
In the main currency: 1€ + 10% of 10€ = 2€
In the second currency, I translate the fixed cost of 1€ through wmc_get_price(1), fine: 1.2$, and the product price comes to me in $, out of the box: 12$
When I calculate the shipping cost: 1.2$ + 10% of 12$ = 2.4$, ok… but:
In the cart, the shipping rate is re-converted, and appears: 2.88$ (2.4 x 1.2 exchange rate again!)
…there is a way to stop this double re-conversion? I searched into your code, and I only found one way, add some conditional in your code (the bold code):
in the file /frontend/shipping.php, about line 80:
public function woocommerce_package_rates( $methods, $package ) {
if ( count( array_filter( $methods ) ) ) {
foreach ( $methods as $k => $method ) {
if ( $method->method_id == ‘betrs_shipping’ || $method->method_id == ‘printful_shipping’|| $method->method_id == ‘easyship’ ) {
continue;
}
if (substr($method->id, 0, 12) == ‘fish_n_ships’) continue;
…I can’t find a better way (through some parameter in the Fish and Ships shipping rate object, or a filter to do it)… but if you appoint me in the right direction, we’re happy to be compatible with your plugin without you having to do any change on your code.
Thanks in advance,
Martin
wp-centrics dev team