PluginProbe
Pay with Vipps and MobilePay for WooCommerce / 6.2.1
Pay with Vipps and MobilePay for WooCommerce v6.2.1
6.2.3 6.2.2 6.2.1 6.2.0 6.1.10 6.1.9 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1.0 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 6.0.0 5.4.3 5.4.2 5.4.1 5.4.0 All 185 releases
← All changes | payment/VippsCheckout.class.php +33 -0 5.3.46.2.1 View file →
@@ -364,8 +364,9 @@
364 364 // Ensure we remove the current session on the thank you page (too).
365 365 add_action('woocommerce_thankyou_vipps', function () {
366 366 WC()->session->set('vipps_checkout_current_pending',false);
367 367 WC()->session->set('vipps_address_hash', false);
368 + WC()->session->set('vipps_shipping_rate_id_map', false);
368 369 });
369 370
370 371 // For Vipps Checkout - we need to know any time and as soon as the cart changes, so fold all the events into a single one. IOK 2021-08-24
371 372 add_action( 'woocommerce_add_to_cart', function ($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data ) {
@@ -667,8 +668,9 @@
667 668
668 669 $orderid = intval($_REQUEST['orderid']??0); // Currently not used because we are using a single pending order in session
669 670 $lock_held = intval($_REQUEST['lock_held'] ?? 0);
670 671 $type = $_REQUEST['type'] ?? "unknown"; // Type of callback
672 + $polldata = $_REQUEST['pollData'] ?? []; // the actual Checkout js event data. LP 2026-03-19
671 673
672 674 Vipps::set_locale_if_in_header();
673 675
674 676 // The single current pending order. IOK 2025-04-25
@@ -798,8 +800,39 @@
798 800 $order->save();
799 801 }
800 802 }
801 803 }
804 + }
805 +
806 + switch ($type) {
807 + // Store the newly selected shipping method in session. LP 2026-03-19
808 + // NB: selecting a new pickup location option inside the same pickup location group does NOT trigger an event here. LP 2026-03-19
809 + case 'shipping_selected':
810 + if (!is_a(WC()->session, 'WC_Session') || !is_a($order, 'WC_Order')) {
811 + /* translators: order id */
812 + $this->gw->log(sprintf(__('Checkout ajax new shipping: session not ok for order %1$s.', 'woo-vipps'), $order->get_id()), 'error');
813 + break;
814 + }
815 +
816 + $new_shipping_key = $polldata['id'] ?? null; // our custom key like '$flat_rate$a1vkbszd221:index' used in shipping table, NOT the same as woo rate_id. LP 2026-03-19
817 + if (!$new_shipping_key) {
818 + break;
819 + }
820 +
821 + // Retrieve the woo rate id for new shipping selection, we have stored this in the session. LP 2026-03-20
822 + $shipping_rate_id_map = WC()->session->get('vipps_shipping_rate_id_map');
823 + $new_shipping_rate_id = $shipping_rate_id_map[$new_shipping_key] ?? null;
824 +
825 + if (!$new_shipping_rate_id) {
826 + /* translators: order id, shipping rate key */
827 + $this->gw->log(sprintf(__('Checkout ajax new shipping: did not find shipping rate id for the new shipping choice "%2$s" order %1$s.', 'woo-vipps'), $order->get_id(), $new_shipping_key), 'error');
828 + break;
829 + }
830 +
831 + $change = true;
832 + WC()->session->set('chosen_shipping_methods', [$new_shipping_rate_id]);
833 + WC()->session->save_data();
834 + break;
802 835 }
803 836
804 837 if ($ok && $change) {
805 838 wp_send_json_success(array('msg'=>'order_change', 'url'=>''));