Our developers recently built an e-commerce site built on the Woocommerce plugin for WordPress. Part of the requirements we had was for their staff to be able to take orders over the phone without having to scout around the website for the products, adding them to the basket and going through the checkout as a usual website visitor would.

 

The Problem

We installed a premium plugin called “phone orders for Woocommerce” which allowed our client to search the products and add them to a list, generate an invoice and then process the payment on behalf of the customer. However, using the Sagepay plugin to process those payments, they came up against a barrier. The barrier was that every so often, it would present our client with the 3D Secure card checks of which obviously shouldn’t ever be given over the phone by the customer for fraud prevention purposes.

The options we had were either turn off the 3D Secure checks for all or keep them on for all.

 

The Solution

We had a chat with the friendly team over at Sagepay and they told us we needed to change the account type code from an “E” to an “M”. Having had a look into the documentation for the Sagepay plugin for Woocommerce, we found a filter, but not to do what we needed to do which was conditionally change the “E” account type to an “M”. We had a little dig into the code and found a filter not documented and so we thought we might be helpful and share this with other members of the community. Our solution is below.

// Pop this in your functions.php
function apx_telephone_order_payment( $data ) {
  // EG: If order is a telephone order.. make the account type parse M
  if ( $your_conditional === true ) {
    $data['AccountType'] = 'M';
  }

  return $data;
}

// Add the filter to the account type
add_filter('woocommerce_sagepay_direct_data', 'apx_telephone_order_payment');