One of the limitations when it comes to uploading images for Products using the WooCommerce REST API is that you have to either include a source URL for WooCommerce to download the image from, or include the ‘ID’ for the image from the WordPress Media Library. The WooCommerce API doesn’t allow for files to be uploaded directly from a FileMaker container field, which is where you would typically store them in FileMaker.

The WordPress REST API, which the WooCommerce API is fully integrated with, does allow for media files to be uploaded directly to the WordPress Media Library. This provides us with a solution to the problem of wanting to directly upload images from FileMaker container fields:

  1. upload the image directly to the WordPress Media Library
  2. copy the WordPress ID for the media item
  3. paste this into a WooCommerce Product Image and upload the Product

Until the WooCommerce API allows for direct media uploads this is the next best solution and is supported in fmEcommerce Link (WooCommerce Edition) v1.6 or later. This requires some additional setup as we have to authenticate with the WordPress API which works slightly differently to the WooCommerce API and requires the installation of a WordPress plugin to facilitate this.

To setup fmEcommerce Link for container field uploads you will need to complete the following steps:

1. if you are using a version of WordPress before v5.6 you will need to install the Application Passwords WordPress plugin in your WordPress Plugins page and activate this (This plugin has been merged into WordPress core version 5.6 and doesn’t have to be installed separately).

2. once installed go to your list of WordPress Users, click on the User you wish to create the password for and scroll down to the Application Passwords section and enter a name and click the Add New button:

3. a dialog will appear showing the password. Copy this as it is the only time this password will be visible (you can always create a new one if required) and click the Dismiss button

4. in the fmEcommerce Link file click the Setup navigation button and towards the bottom are the WordPress Media Upload Preferences. Enter the WordPress Username and the password that was created by the Application Passwords plugin:

You’re now ready to test uploading and downloading Media items between FileMaker and WordPress.

Downloading Media Library Items from WordPress: you can download Media Library Items (doesn’t include the actual files) from WordPress by going to the Setup screen > Media tab. From here you can click the Import All Media button to download all your Media Library Items from WordPress to FileMaker:

Click the arrow button to navigate to the Media Details layout where you can view the full details for each Media Item.

Uploading Media Library Items to WordPress: to upload Media Library Items to WordPress from a FileMaker container field go to the Media Form layout and create a new record. Click the Insert File button and select the file you wish to upload:

then click the Push to WordPress – Current Record button. This will upload the file from the container field to the WordPress Media Library and if successful it will return the WordPress Media ID in the WordPress ID field:

You can then copy and paste the WordPress ID into the ID field when uploading a Product Image and it will link to the Media Library file:

You can edit the following fields and upload the Media record to WordPress again to update it (you have to first upload the file to create the Media Library record in WordPress):

  • Title
  • Description
  • Caption
  • Slug
  • Alt Text
  • Status (choose an option from the drop down list)

If you have already uploaded a file you cannot change the file. You must create a new record and upload that.

We have a video demonstrating the Media Upload in action on the fmEcommerce Link (WooCommerce Edition) Videos page (you can also view this on YouTube here).