Share the Love (and Savings!) with Your Friends

Amazon’s Share the Love program lets you and your friends save money by buying the same products. Here’s a way to keep track of who wants what.

Amazon’s “Share The Love” feature lets you send a 10% discount to people for the products you’ve purchased. For example, as you’re checking out while purchasing The Matrix DVD, you’re given the option to send a Share the Love discount via email. If anyone you send the discount to purchases the The Matrix DVD within a week, you’ll receive a credit (the amount the 10% provides off of the regular price—so the more expensive an item, the bigger the credit).

The problem is, it’s hard to know who among your friends is interested in the products you’re purchasing. (Not to mention the struggle to remember their email address while you’re checking out.)

This script comes to the rescue by gathering product requests from your friends, allowing all of you to share the savings with each other when you purchase products from Amazon. As you check out at Amazon, you can stop by this script to see if any of your friends have requested discounts for the products you’re purchasing.

The Code

This PHP script performs two separate actions depending on what variables are passed to it. If someone is adding a product they’d like to receive a discount on, it adds their email address to a text file. (The file is written to the same directory as the script with the name of the ASIN as the title, ASIN.db.) If someone is looking ...

Get Amazon Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.