Amazon Link
Two requests (4 posts)

  1. teknofilo
    Posted 2 years ago #


    I would like to see these two features implemented:

    * Ability to enter 2 or more ASINs for a specific link and the plugin shows only the link for the cheapest one. In Amazon Spain (not sure about other Amazon sites) the same product may have different ASINs with different prices (e.g. some of them are 'imported versiones' or the same item is sold by an Amazon partner). I would like to show the cheapest one every time.

    * Ability to report broken links, so that if a product is no longer listed in Amazon then I can easily be aware of it.

    I hope you can implement them.


  2. paulstuttard
    Plugin Author

    Posted 2 years ago #


    Sorry for the late response, for some reason I did not get an email notifying of your post.

    The first part of your request would be really difficult to do inside the plugin, it is built around the concept of a single ASIN for each locale. Multiple ASINs causes it to create multiple links.

    The best way to achieve what you want would be do pre-process the data then send the preferred ASIN to the plugin. I might be able to provide some example code for this if it is something you might consider?

    The second part I have been thinking about for some time, i.e. some sort of 'health check' page to check the settings and affiliate IDs are entered correctly and all the links are render correctly. The key problem is that with a large site it would generate a large number of AWS requests in a very short period of time, this would probably cause the AWS server to reject most of the requests.


  3. teknofilo
    Posted 2 years ago #

    For the 1st part, if you can provide some sample code, that could help.

    For the 2nd part, you don't need to run a health check for all links at a specific time. Everytime your plugin runs (because the visitor has accesed a page with an Amazon link), it detects if the link has failed, doesn't it?. In that case it should report it through an email, an alert in the WP dashboard, etc.

  4. paulstuttard
    Plugin Author

    Posted 2 years ago #


    This is the code to do a basic price check and show the lowest price, you could wrap it in a shortcode callback to allow you to put it in a post:

    if (isset($awlfw)) {
       $asins = array('0340993782', '014311977X', '0340994398');
       $best_price = 999999;
       $best_product = NULL;
       foreach ($asins as $asin) {
          $details = array_pop($awlfw->cached_query($asin));
          // Strip $,EURO,£, etc.
          $raw_price = preg_replace('/[^0-9.]/','',$details['offer_price']);
          if ($raw_price < $best_price) {
             $best_price = $raw_price;
             $best_product = $details['asin'];
       if (!empty($best_product)) {
          echo amazon_shortcode("asin=$best_product&live=1&template=wishlist");

    The second part I'll add to the list of potential enhancements for the next version of the plugin.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Amazon Link
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic