Everything you need to know about the APF lookup table add-on

This document explains what the lookup table add-on for Advanced Product Fields for WooCommerce does and how it can be set up.

Introduction

As you may already know, Advanced Product Fields allows you to implement lookup tables to change your final product price in WooCommerce. Lookup tables are a great way to match options with specific pricing. It’s typically used for measurement-based pricing. Your customer enters a width & height, and a table is used to look up the matching price for that pair.

In our plugin, lookup tables are created by adding code snippets. If you have many large tables, this isn’t really user-friendly. That’s where this add-on comes in! It allows you to create your lookup tables in your spreadsheet software of choice and then upload it through WordPress. No more code snippets necessary!

Installing the lookup table add-on

To install the lookup table add-on, follow these steps:

  1. Log into your Studio Wombat account and download the plugin.
  2. Install the plugin in your WordPress admin dashboard by going to Plugins → Add New and browsing to the downloaded ZIP file.
  3. Once the plugin is installed & activated, go to WooCommerce → Settings → Product fields → Lookup tables and enter your licens key.
  4. Click Activate.

You’re now ready to use the plugin.

Create lookup tables in a spreadsheet

Before you can upload lookup tables to WordPress, you must create them first. We recommend you do this in Excel or Google Sheets, but you can use any spreadsheet software that is capable of saving your work as a CSV file.

Here is an example of a lookup table created in Google Sheets:

Your tables need to follow the same format. There are 3 things to take into account:

  1. Your table name should always appear in cell A1. You’ll need that able name later in your formula-based pricing. The name should only contain letters, numbers, and underscores. Make sure it doesn’t contain any strange symbols or spaces.
  2. The first column (column A) contains the values of one input field.
  3. The first row contains the values of the 2nd input field.
  4. All other cells contain the amount of price increase for the pair.

Here’s an example of how to read the table:

If your customer enters 240 in your first number field, and 140 in your second number field, then the additional price is $76.

Upload your lookup table

Once your lookup table is created, save it to CSV. In Google Sheets, you can do this by going to File → Download → Comma Separated Values (.csv). In Excel, you can do the same by going to File → Save As and selecting “csv” in the Save as Type list.

To upload your lookup table into WordPress, go to WooCommerce → Settings → Product Fields → Lookup tables and browse to the csv file you saved earlier. Click Save Changes to start uploading the file.

When the file is uploaded and no errors appear, the page refreshes and you can see your saved lookup tables further below:

Use your lookup table

When your lookup table is added to WordPress, you can use it in a formula like so:

lookuptable(my_table_name;62e3facb36439;31f3dag126988)

  • my_table_name is your table’s name as entered in cell A1 of your sheet.
  • 62e3facb36439 is the ID of the first field.
  • 31f3dag126988 is the ID of the second field.

Updating a lookup table

Updating is easy, just re-upload your CSV file! Tables with the same name in cell A1 are automatically overwritten.

That’s it! You now know how to use our Lookup Table Add-on.

Was this article helpful?

Related Articles