Support » Plugin: WebData Custom Shipping Methods for WooCommerce » Fixed shipping multicurrency

  • Resolved ferand

    (@ferand)


    Is it possible to may be add some custom filter to shipping fixed price ?
    I want to be able to set fixed shipping value in usd, euros, not only in my default currency rubles. It is possible to set “20$”, f.e., in the input field of fixed value. May be i can use some custom filter to return value in rubles that equals to entered “20$” string ? Would be great.

    Also, may be you can point me in the right way. I am using WP 5.2.7, woocommerce 3.8.1. Your plugin adds custom method to shipping methods dropdown menu in woocommerce settings while rest plugins(even more popular) simply doesnt show up in that menu oO. I tried 2 plugins, just simply doesnt appear in menu. I’ve enabled them in settings everywhere.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author webdata

    (@webdata)

    Hi,

    Please update the plugin, I added few more filters for the fee variables. Filters and how to use them, you can check here: https://web-data.online/docs/woocommerce-custom-shipping-methods/#developers

    The filter for fixed fee is: woo_custom_shipping_dbf_fixed_price

    Your other shipping method plugins needs to support shipping zones, to be able to see them at the shipping methods list on your selected zone. If your plugins does not support the shipping zones, then you should be able to view them at the main shipping settings page at: WooCommerce – Settings – Shipping. Otherwise you should contact the plugin author.

    Kim

    • This reply was modified 4 months, 1 week ago by webdata.

    Thank you very much for fast and descriptive answer. I will take a look into filters and rest. Ty!!!!!

    Wait. Have you just updated code and added that functionality only on my request and that fast ? 🙂 Wow ! So Good Job man. Just checked it , and it’s working, keep up the good work !

    • This reply was modified 4 months, 1 week ago by ferand.
    • This reply was modified 4 months, 1 week ago by ferand.

    I am able now to use filter and apply rates to entered fixed price value based on multicurrency plugin rates. But i cannot find a way for user to enter price in USD,EUROs. I was thinking about this way:
    1. User can enter just numbers to use default currency – “1000”
    2. User can suffix value with currency sign – “1000$”, “1000e”, e – for euro

    So in filter i can distinguish what currency is used and apply according rates.
    But fixed price field is sanitizied and all chars are removed.

    How can we handle this ?

    temporarily, i’ve removed floatval() for fixed price which is of course not a way out, but in my case it’s suitable, since we don’t use float vals in shipping price. But altering plugin code is bad, for sure.

    Then possible way out could be:
    1. Adding radio buttons before fixed price value to determine currency, or give user opportunity to add and define his own currencies and then pass that value into filter. That way we can give flexibility, and keep floatval for fixed price.

    If you cool with that i can make a pull request for that code

    • This reply was modified 4 months, 1 week ago by ferand.
    Plugin Author webdata

    (@webdata)

    Would it be possible to use some multi-currency plugin instead? Like if you set the fee as rubles, and then the plugin changes it to a different currency at the checkout based on customer’s location?

    Kim

    Possible, but i cant see how it would work without updating plugin code.
    I just added some small changes to plugin to make it work with WOOCS (multi-curr plugin);

    Now i can enter fixed price and free shipping limit in this manner:
    “100$” for USD curr, “100e” or “100E” for EUR curr, and “100” for my default rubles.

    I also added one method for plugin class – get_cart_total_multi_curr(), that returns cart_total based on current currency, before it would return 500 for 500$ which is much smaller than actually 500$ in rubles.

    So, now it all works good, but i altered plugin code 🙁 On update i will lose it all

    • This reply was modified 4 months, 1 week ago by ferand.
    Plugin Author webdata

    (@webdata)

    Ok, how about if I add the price as a string, and pass it as second argument to the filter, would it help?

    Then you could do something like this:

    add_filter(‘woo_custom_shipping_dbf_fixed_price’, ‘my_function’, 100, 2);

    my_function($price_as_float, $price_as_string) {

    // Here detect the currency from the $price_as_string variable, do the logic
    // and return it as a float

    return floatval(1234);
    }

    Kim

    • This reply was modified 4 months, 1 week ago by webdata.

    Yeap, that definetly, would help.

    You can also add a filter for cart_total value, just a simple filter. So i can add my own logic to how this value is formed using different plugins(in my case its WOOCS, and i can just detect current currency by global $WOOCS; $cur_c = $WOOCS->current_currency; and then based on that apply rates to cart_total);

    • This reply was modified 4 months, 1 week ago by ferand.
    Plugin Author webdata

    (@webdata)

    I updated the plugin now, as it takes 2 arguments for fixed price, one as float and another one as a string. This has to be returned as a float.

    Please see the docs for the other two filters I also added: https://web-data.online/docs/woocommerce-custom-shipping-methods/#developers

    Kim

    great, the only thing that remains for my code to work independently of your plugin is the same float_as_string functionality for free_shipping limit value, so i can also enter free shipping limit in USD, EURs etc

    • This reply was modified 4 months, 1 week ago by ferand.
    • This reply was modified 4 months, 1 week ago by ferand.
    Plugin Author webdata

    (@webdata)

    Added now, please update.

    Kim

    Got it , good job , ty

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.