WP Get Products From Amazon PA API 5 Documentation

WP Get Products From Amazon PA API 5
WP Get Products From Amazon PA API 5

WP Get Products From Amazon PA API 5 allows you to easily add products from Amazon PA API 5 to your website. The plugin retrieves product title, image url, features and affiliate link from the API. It can be downloaded from the GitHub repository.

Disclaimer: This plugin is NOT associated with Amazon in any way.

Table of Contents:


  1. Navigate to the releases page of the repository.
  2. Download the latest release zip file
  3. Rename the zip folder to wp-gpfa.zip
  4. Rename the folder in the wp-gpfa.zip folder to wp-gpfa
  5. On your WordPress website navigate to the plugins section and upload the plugin (wp-gpfa.zip)
  6. Click Activate
  7. Click Settings -> WP Get Products From Amazon PA API 5 in the main menu and configure the plugin
  8. Add shortcode [gpfa asin=”asinNumber”] where asinNumber is asin number of Amazon product.

Alternatively you can upload the contents of the downloaded zip file to wp-content/plugins directory of your website. Do rename the uploaded folder to wp-gpfa.


WP Get Products From Amazon PA API 5: Settings
WP Get Products From Amazon PA API 5: Settings

Below is a brief description of settings:

Amazon PA API Access Key

Access key is used for authentication with Amazon PA API. You get the access key in your Amazon Associates account (conditions apply).

Amazon PA API Secret Key

Secret key is used for authentication with Amazon PA API. You get the secret key in your Amazon Associates account (conditions apply).

Amazon Associates Tag

Here you should insert your Amazon associates tag which you can generate in your Amazon Associates account. The tag is used to track sales, based on which you receive commissions.

Enable Smart Cache

Smart cache saves products information in the database for better performance. Information about products is kept in the database but regularly updated via CRON job. This prevents issues with page speed and throttled requests from Amazon API.

Refresh Cache

Here you select how often information about the products should be updated in the database (cache). Possible options are hourly, twice daily and daily.

Clear Cache

If you enable this option, the cache will be flushed every time you save changes.


Hooks allow you to further customize the plugin.

Change locale



The gpfa_host and gpfa_region filters allow you to change locale. Default locale is United States. The code below changes locale to Germany. Locale information is available here.

add_filter( 'gpfa_host', 'blazzdev_different_locale_host' );

function blazzdev_different_locale_host( $host ) {
  return 'webservices.amazon.de';

add_filter( 'gpfa_region', 'blazzdev_different_locale_region' );

function blazzdev_different_locale_region( $region ) {
  return 'eu-west-1';

Limit how many products are updated on cache refresh


If you refer many products on your website, it’s recommended that you limit how many products are refreshed when cache refresh function runs. This prevents server timeout issues. The snippet bellow limits cache refresh to 50 products.

add_filter( 'gpfa_max_products', 'blazzdev_limit_cache_refresh' );

function blazzdev_limit_cache_refresh( $maxProducts ) {
  return 50;

Increase API query interval on cache refresh


API query interval for cache refresh is set to 1s so that requests don’t get throttled (PA API allows only one request per second). You can increase this interval with the gpfa_query_interval filter. Note that this applies only to products that are already stored in cache. The snippet bellow changes API query interval to 2 seconds.

add_filter( 'gpfa_query_interval', 'blazzdev_change_cache_refresh_api_calls_interval' );

function blazzdev_change_cache_refresh_api_calls_interval( $interval ) {
  return 2; // 2 seconds between each query

Do something after cache has been refreshed


The plugin generates a report after the cache has been refreshed which includes the total number of products scheduled for update, the total number of updated products and errors. The snippet below will print the report into error log.

add_action( 'gpfa_after_refresh_cache', 'blazzdev_log_report', 10, 1 ); 

function blazzdev_log_report( $report ) {
  error_log(print_r($report, true));

Custom Template

While the plugin comes with a very basic template, it is recommended to create a custom template which fits your website. To use a custom template create wp-gpfa folder in your child theme or theme and copy the following template from the plugin to the folder:

  • /wp-content/plugins/wp-gpfa/public/templates/basic-template.php

To see what information about the product is available, include the snippet below to the template:

<?php print_r($product); ?>

Blaz K.

I am a web developer with experience building WordPress websites, plugins and themes. I specialize in PHP and have professional experience working with JavaScript, CSS, PostCSS, Gulp and HTML. I also have experience working with PrestaShop, GIT and SEO.

Leave a Reply

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