Tag: wordpress

0

WooCommerce: getAddress.io Postcode Lookup

Update: Version 1.1 released on 25th February 2019, on the plugin repository. See changelog on the plugin repository for more information.

This, my third WordPress plugin (and also my third WooCommerce plugin, apparently I really like doing stuff with WooCommerce!) adds a postcode lookup tool to the checkout in WooCommerce 3.x that lets your UK-based customers quickly fill in their billing/shipping addresses based on their postcode.

It utilises the great getAddress.io API for the postcode lookup, and as such requires an API key for their service. I’d always recommend the £10 per month pricing plan, simply because it offers the best value, but they have a number of others available.

Plugin Features

  • Adds postcode lookup for both billing and shipping addresses
  • Administrators can turn off the lookup for either address, if needed
  • (v1.1) Uses an internal cache for each customer to prevent repeated calls for the same postcode eating up API usage limits
  • Correctly uses the WooCommerce “locale” system to show and hide the lookup button when appropriate
  • Has full internationalisation (i18n) and localisation (l10n) support – so if you want to translate the plugin into your own language, please get in touch!

Screenshots

The plugin adds a Find Address button next to the postcode field, and moves the Postcode field so that it is the first field filled in after selecting United Kingdom as the country.

When the Find Address button is clicked, the user is presented with a menu of available addresses:

In the WordPress back-end, administrators have the following settings available:

Installation

As with all WordPress plugins, you just need to drop the plugin folder into your wp-content/plugins folder and then activate the “GazChap’s WooCommerce getAddress.io Postcode Lookup” plugin.

Requirements

I’m using WordPress 5.1 and WooCommerce 3.5.5 – please let me know in the comments if it doesn’t work on other versions. I believe it requires at least WooCommerce 3.0.0.

Download

Download the plugin from the WordPress Plugin Repository (8.3KiB Zip)

Source

This plugin is open-source – view the source code on the GitHub repository.

3

WooCommerce: Purchase Order Payment Gateway

Update: Version 1.1 released on 26th August 2018, on the plugin repository. See changelog on the plugin repository for more information.

A recent project required the ability for customers on a client’s WooCommerce website to be able to request an invoice for their order (and thus pay offline) – but with the added twist that it required a Purchase Order number. This twist meant that simply changing the name of WooCommerce’s built-in “Offline” gateway was not enough.

I had a quick look around and found an existing plugin for WooCommerce that added this functionality, but as seems to be common when I do this, the functionality left a little bit to be desired.

First of all, the plugin required the customer to enter a postal address for the invoice (and curiously, didn’t automatically pull through the customer’s billing address) – I only needed a Purchase Order number field.

Additionally, it wasn’t very well internationalised – some strings were set as translated, but others – particularly in the HTML output that the plugin generated on the front-end and the admin back-end, were not.

So, I’ve taken it upon myself to learn a bit more about WooCommerce’s Payment Gateway API, and have written my own – which you can download below.

Plugin Features

  • Adds an offline payment gateway for WooCommerce with the name Purchase Order
  • Allows the administrator to set the plugin to ask for a Purchase Order number (or not) – and whether to make it mandatory if one is asked for
  • Has a setting that gets the plugin to ask for a postal address for the invoice to be sent to
  • Has another setting that, if an address is being asked for, will pre-fill the address with the customer’s billing address if they are logged in to WooCommerce during checkout
  • Adds the submitted Purchase Order details to the Edit Order screen in the WooCommerce back-end
  • Has full internationalisation (i18n) and localisation (l10n) support – so if you want to translate the plugin into your own language, please get in touch!

Screenshot

The gateway itself looks very straightforward – the screenshot below has the “ask for address” options turned off, though. When turned on, the plugin asks for a Contact Name, Company/Organisation, and an address (two lines, plus city, county and postcode).

In the WordPress back-end, Purchase Order information is shown under the General Details section on the Edit Order screen:

Installation

As with all WordPress plugins, you just need to drop the plugin folder into your wp-content/plugins folder and then activate the “GazChap’s WooCommerce Purchase Order Payment Gateway” plugin.

Requirements

I’m using WordPress 4.9.4 and WooCommerce 3.2.6 – please let me know in the comments if it doesn’t work on other versions. I believe it requires at least WooCommerce 3.0.0.

Download

Download the plugin from the WordPress Plugin Repository (5.2KiB Zip)

Source

This plugin is open-source – view the source code on the GitHub repository.

1

How to enable checkbox lists for non-hierarchical taxonomies in WordPress

WordPress’ taxonomy features are one of the most powerful aspects of the platform, giving you the capabilities to group posts (including custom post types) in pretty much as many ways as you can think of. There are two types of WordPress taxonomy – hierarchical and non-hierarchical. In case it’s not obvious from the name, a hierarchical taxonomy […]

Read full post >

0

Site upgrade

I’ve spent the last couple of days converting my site to the WordPress platform, rather than using my own bespoke content management platform. It’s taken me far too long to start espousing the benefits of WordPress over other systems, but having done an increasing amount of work with it in the last year I’m now […]

Read full post >