API requests

This page contains information about ASA2 PHP functions you can use in your scripts to manually send requests to the Amazon Product Advertising API.


Deprecated Asa2_Service::itemLookup

Use asa2_item_lookup instead.


This function lets you work directly with an ASA 2 item object. You can access all placeholder keys as public properties.


$item = asa2_item_lookup( $asin [, array $options] );

API documentation

Check the API documentation page for more details.

ASA2 API documentation



The ASIN of the product you want to render


An array of Options (same as for the [asa2] shortcode).

  • ajax Set to 1 activate the AJAX mode

  • country_code The product’s country code

  • no_cache Set to 1 to bypass the cache

  • tpl The template name

  • tplid The template ID

  • tracking_id Custom tracking ID


Based on the custom field “asin” this code tries to create an ASA 2 item object by using the asa2_item_lookup() function. You can check if the result is a valid object by using function asa2_is_item_object().

On a valid item object you can access all Placeholders as public properties. For example, if you want to access the item’s title, known as placeholder {{ Title }}, use $item->Title.

// get ASIN from custom field
$asin = get_post_meta($post->ID, 'asin', true);

if (!empty($asin)) {

    $tplid = get_post_meta($post->ID, 'tplid', true);

    $options = array();
    if (!empty($tplid)) {
        $options['tplid'] = $tplid;

    $item = asa2_item_lookup($asin, $options);

    if (asa2_is_item_object($item)) {
        // it is an ASA 2 item object

        echo '<h1>' . $item->Title . '</h1>';
        printf('<img src="%s" width="%d" height="%d">', $item->SmallImageURL, $item->SmallImageWidth, $item->SmallImageHeight);
        echo 'List price: ' . $item->ListPriceFormattedPrice . '<br>';
        echo 'Current price: ' . $item->OffersMainPriceFormattedPrice . '<br>';
        echo $item->CustomerReviewsImgTag;