• I activated the Vipps Checkout function that replaces the normal Woo checkout. However I have a function running in the theme that adds the email address to the URL of the order confirmation page. It’s triggered by woocommerce_payment_successful_result. This function breaks when I run the Vipps checkout. Is there a different trigger I have to run?

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

    (@iverok)

    Could you post a version of the code here so I could try to replicate?

    I think what you are describing is a bug that will be fixed in the next version of the plugin, but unfortunately we didn’t dare releasing that version just before christmas. It should be ready early in the new year.

    Thread Starter birgerb

    (@birgerb)

    add_filter('woocommerce_payment_successful_result', 'add_email_to_url', 10, 2);
    function add_email_to_url($result, $order_id){
        
    // Get an instance of the WC_Order Object from the Order ID (if required)
    $order = wc_get_order( $order_id );
    
    // Get the Customer ID (User ID)
    $customer_id = $order->get_customer_id(); // Or $order->get_user_id();
    
    // Get the WP_User Object instance
    #$user = $order->get_user();
    
    // Get the Customer billing email
    $billing_email  = $order->get_billing_email();
        
        $result['redirect'] = $result['redirect'].'&email=' . $billing_email;
        return $result;
    }

    What I’m hoping to achieve is that after successful payment the Vipps plugin will return to the order confirmation page and retain the email in the URL. This is part of Google Analytics functionality and they claim to have implemented it successfully with Vipps before.

    Plugin Author Iver Odin Kvello

    (@iverok)

    Right, then that is not the correct filter – the “redirect” URL in that filter is actually the URL to the Vipps payment screen, and is not even used in Vipps Checkout or Vipps Express Checkout.

    For the order confirmation screen, you will normally use the filter

     'woocommerce_get_return_url', $return_url, $order  

    — You should be able to add GET arguments to this.

    Note when paying with Vipps there is normally a screen “between” the payment gateway and the order confirmation screen. This shouldn’t matter if what you need to modify is the order confirmation screen however.

    For GA you can also add datalayer data in the

    woocommerce_thankyou_vipps

    — hook; and you can also and more reliably use the measurement protocol (more reliable because not all customers actually return to the confirmation screen).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom URL from webstore’ is closed to new replies.