Websites, Design & Online Marketing

Poli Payments in Woocommerce 2.6

*** Update November 2016 ***

I have been contacted by the development team at Poli Payments who tell me a new Woocommerce plugin is on the way.  Keep your eye on their website, I guess.

*** *** ***

If you just upgraded to Woocommerce 2.6 or 2.6.1 and you’re having trouble with the Poli Payments gateway this post might save you a little bit of time.  I recently installed version 1.4 of the Poli Payments plugin for Woocommerce on top of Woocommerce 2.6.1 and was disappointed to find a completely empty admin form on the Poli Payments area of the Woocommerce Checkout Settings.

The problem arises due to a change in the way Woocommerce generates output for the payment gateway plugins (the function output() in the file class-wc-settings-checkout.php).  Prior to version 2.6 Woocommerce converted the current payment gateway id to lower case before displaying the admin options.

if ( strtolower( get_class( $gateway ) ) == strtolower( $current_section ) ) {
  $gateway->admin_options();
  break;
}

In Woocommerce 2.6 and later the strtolower() check on $current_section is no longer performed.

if ( in_array( $current_section, array( strtolower($gateway->id), sanitize_title( get_class( $gateway ) ) ) ) ) {
  $gateway->admin_options();
  break;
}

I’m not sure why the lower case conversion has disappeared but I definitely don’t want to work round the problem by making changes inside the Woocommerce plugin.

Fortunately I found a simple work-around, involving a one-line change to the poli.php payment gateway file.

On line 32 of poli.php in the 1.4 Poli Payment Gaetway change this:

$this->id = 'POLi';

to this:

$this->id = 'poli';

Converting the id to lowercase ensures that the test passes for the Poli gateway. After making this change the admin settings for my Poli Payments Gateway were displayed. I was able to enter my Merchant and Authentication Codes and get the payment gateway to connect to and process payments using Poli’s Test Bank.

 

3 thoughts on “Poli Payments in Woocommerce 2.6

  1. There still is no plug-in in 2017 (as of mid-feb and no mention of an update by the team when I emailed)… I think that was sales speak…

    Thanks for these updates, a good starting point for us. We also found and extra ampersand in version 1.4 also on line 56 (from memory) that threw another error also.

    I’m rewriting the plug-in from scratch for our implementation so that it can also integrate with a few other advanced woocommerce plugins.

Leave a Reply

Your email address will not be published. Required fields are marked *