• Hi,

    I am using Conditional Shipping methods on the website and I would like to know if there is an filter/action/hook or something that can help me send in only active session based Shipping Methods to VIPPS Checkout?

    As it is now VIPPS Checkout retrieves all Shipping Methods from WooCommerce but I need to send in only methods that are active from session.

    Is it possible to to what I ask?

    Best regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter DamirCalusic

    (@webkreativ)

    I would basically try to use the WC()->session->get('previous_shipping_methods') and see if it works like I want it to work. Together with your Shippings like Porterbuddy, Instabox and Helthjem which should always be there if active in admin.

    Is it possible with any action/filter for me to modify the methods sent to ti VIPPS checkout? As I stated as for now it fetches all shipping method activ in admin, not the ones that are indeed in use on frontend based on session and conditional logic.

    • This reply was modified 1 year, 8 months ago by DamirCalusic.
    Plugin Author Iver Odin Kvello

    (@iverok)

    Yes, there are filters, if I understand you correctly it seems you may want to use the ‘woo_vipps_express_checkout_shipping_rates’ filter which takes and returns a list of WC_Shipping_Rate objects. You should be able to filter those you do not want there.

    $methods = apply_filters('woo_vipps_express_checkout_shipping_rates', $methods, $order, $acart);

    the session from WC()->session is available at this point. It returns the actual list of shipping rate objects calculated for the cart/session.

    If you are using static shipping, it gets called just once, at the start of the order. Otherwise it gets called each time the user changes their address.

    You can also, in the is_available method or filter of any given shipping method, check the value of

    apply_filters('woo_vipps_is_vipps_checkout', false);

    — this will be true only if you are currently producing shipping methods for Vipps Checkout. You can add this to ‘woocommerce_package_rates’ for instance, or in the ‘woocommerce_shipping_<method id>_is_available’ filters.

    If you need more hooks, we can probably add them.

    Thread Starter DamirCalusic

    (@webkreativ)

    Hi,

    Thank you for a quick answer. I will check into this and come back with the results I find.

    Many thanks.

    Best regards.

    Thread Starter DamirCalusic

    (@webkreativ)

    Hi,

    I have done some testing. There seems to not be any filter called woo_vipps_express_checkout_shipping_rates I have checked the plugin aswell and cannot find any filter with that name.

    Is that the correct filter?

    Plugin Author Iver Odin Kvello

    (@iverok)

    In the latest version, it is in the file Vipps.class.php at line 2844, in the method that handles callbacks to the shipping alternatives.

    This is the plugin with slug woo-vipps, version 1.14.3.

    Thread Starter DamirCalusic

    (@webkreativ)

    Ah yes, I found it. Thank you. I will look at it and come back with my findings. Thanks again for quick repsonse.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display Active shipping methods only’ is closed to new replies.