Or, embed this snippet using GenerateWP WordPress Plugin.



Shortcode: Amazon Add-To-Cart Button

Simply set the affiliate id and product asin in the shortcode:

[addtocart affiliateid=”” productasin=””]

// Add Shortcode
function amazon_addtocart( $atts ) {

	// Attributes
	extract( shortcode_atts(
			'affiliateid' => '',
			'productasin' => '',
		), $atts )

	// Code
return '<form method="GET" action="http://www.amazon.com/gp/aws/cart/add.html"> <input type="hidden" name="AssociateTag" value="' . $affiliateid . '"/> <input type="hidden" name="SubscriptionId" value="[AWSAccessKeyId]"/> <input type="hidden" name="ASIN.1" value="' . $productasin . '"/><br/> <input type="hidden" name="Quantity.1" value="1"/><br/> <input type="image" name="add" value="Buy from Amazon.com" border="0" alt="Buy from Amazon.com" src="http://images.amazon.com/images/G/01/associates/add-to-cart.gif"> </form>';
add_shortcode( 'addtocart', 'amazon_addtocart' );