• Resolved drommerom2017

    (@drommerom2017)


    We are using Checkout with Vipps for WooCommerce as integration between our WordPress website and Vipps.

    The setting we are using is the express checkout that is added to the product page. However, the plugin is not capturing any shipping methods that we have. We are using Table Rate Shipping and seem not compatible (tested with Twenty Nineteen with only table rate, WooCommerce, and Vipps enabled.)

    Is it possible that we can have a default price of 590 NOK including tax to be added regardless of the quantity of the items? If you can provide some codes on how to do that, that would be awesome.

    Looking forward to your reply.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Iver Odin Kvello

    (@iverok)

    Yes, that’s easy enough; it should also be available by just adding a “flat rate shipping” entry. Table rate shipping ought to work though; are you using a specific plugin or the standard Woo shipping methods.

    Are you getting the ‘no shipping methods’ error?

    In any case, you can add a failsafe method like this:

    add_filter('woo_vipps_shipping_methods', function ($return, $order, $acart) {
     global $Vipps;
     $methods = $return['shippingDetails'];
     $methods[] = array('isDefault'=>'N','priority'=>'1','shippingCost'=>'590.00','shippingMethod'=>'Fastpris Frakt','shippingMethodId'=>'flat_rate:flat_rate;118');
     $newreturn = array('addressId'=>$return['addressId'], 'orderId'=>$return['orderId'], 'shippingDetails'=>$methods);
     return $newreturn;
     }, 10, 3);
    Thread Starter drommerom2017

    (@drommerom2017)

    Hello @iverok

    I will try your advice and see if this works!

    Hello @iverok,

    Developer here on Drommerom. I have just tried your hook but the filter woo_vipps_shipping_methods is not even called. I have tried to die(); inside the function but no luck.

    Can you please check once again the hook?

    Kind regards,
    Junnel

    Plugin Author Iver Odin Kvello

    (@iverok)

    Yes, I’ve tested it, and tested it just now; it works when added to your child-themes functions.php or in a plugin.

    Are you getting no shipping methods at all? It may be that a firewall is blocking the shipping methods callback. It could also be that an error occurs earlier in the shipping-method process.

    This version will log to the WooCommerce log called woo-vipps when it runs:

    add_filter('woo_vipps_shipping_methods', function ($return, $order, $acart) {
     global $Vipps;
     $Vipps->log("Running custom shipping methods code", 'DEBUG');
     $methods = $return['shippingDetails'];
     $methods[] = array('isDefault'=>'N','priority'=>'1','shippingCost'=>'590.00','shippingMethod'=>'Fastpris Frakt','shippingMethodId'=>'flat_rate:flat_rate;118');
     $newreturn = array('addressId'=>$return['addressId'], 'orderId'=>$return['orderId'], 'shippingDetails'=>$methods);
     return $newreturn;
     }, 10, 3);

    You should check that log for error messages; and any “Fatal error” logs. You could try modifying the result to an earlier hook, but it is very probable that you either have something causing an error on the callback, or are blocking callbacks to your server.

    Try to look in your access log for calls like this:

    POST /wc-api/vipps_shipping_details?tk=...

    These are the queries from the Vipps servers to your store for shipping information. If these are missing, or produces something other than a 200 result, this must be fixed first.

    Plugin Author Iver Odin Kvello

    (@iverok)

    Closing this issue now as as of version 1.4.0 this is no longer the correct way of modifying shipping methods. The new version would be

    add_filter(‘woo_vipps_express_checkout_shipping_rates’, function ($return, $order, $acart) {
    global $Vipps;
    $methods = $return[‘shippingDetails’];
    // Shipping is 590 including tax, so 472 without.
    $shipping_taxes = WC_Tax::calc_shipping_tax(472, WC_Tax::get_shipping_tax_rates());
    $shipping_rate = new WC_Shipping_Rate(‘flat_rate:0’, ‘Fastpris frakt’, 472, $shipping_taxes, ‘flat_rate’);

    $methods[] = array(‘isDefault’=>’N’,’priority’=>’1′,’rate’=> $shipping_rate);

    return $methods;
    }, 10, 3);

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘VIPPS Shipping method not capturing’ is closed to new replies.