• Hi! I have a plugin that gets the shipping rate for Australian shipping but my store is using USD as the main currency. When it returns the shipping price it adds the AUD value to the total which means an order that should have been $11.56 is $13.45.

    They’ve given me some code to change the price to the USD exchange rate, which I have set up in your plugin…I am hoping you can give me a variable to set the $aus_to_usd_rate’s value to that which the plugin has already found the exchange rate for?

    The whole code is here, to be added to functions.php, in case you need to see it all. I just want to connect the two plugins a little so that your exchange rate value is being used. Thank you so much!!

    ////////////////////////
    function auspost_adjust_shipping_rate( $rates ) {
    $aus_to_usd_rate = 0.75;
    // Loop through each rate
    foreach ( $rates as $rate ) {
    // Store the previous cost in $cost
    $cost = $rate->cost;
    // Adjust the cost as needed
    $rate->cost = round($cost / $aus_to_usd_rate, 2);
    } return $rates;
    return $rates;
    }
    add_filter( ‘woocommerce_package_rates’, ‘auspost_adjust_shipping_rate’, 10 );
    /////////////////////////////

    https://wordpress.org/plugins/woo-multi-currency/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Variable for exchange rate’ is closed to new replies.