Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce with Zen Cart!

Zen Cart product bought

Zen Cart Product Bought Within and Product Bought

A Zen Cart™ module to permit you to determine if a logged in customer has purchased a product before (ever or within a specific date range).

Relevance: Zen Cart™ 1.3.9, 1.5.x

Current Version: 1.0 (version history)

Support Thread: My commercial software is not supported on the Zen Cart forum. Please email me questions instead.

Cost: $15.00 (Note: this low price covers software only for self-installation.)

Buy Now

Would you like to ask me questions before buying? I'm happy to help likely purchasers make the right decision. Please use my contact form.

Installed Cost: $100.00 (Professional installation by That Software Guy)

Installation Difficulty: Moderate - requires template changes

Installation Instructions: click here for installation instructions

Buy: Buy Product Bought Within!
Pre-purchase questions? No problem! Just Please contact me with your question.

Video: You may watch Product Bought Before in action in this video:


Product Bought is a function you can call to determine if the currently logged in customer has ever purchased a particular item. Product Bought Within offers the same functionality, but with the additional check that the purchase have been made within a particular number of days, weeks or months. Customers must be logged in for these functions to work.

Both functions are included in the download.

These functions may be used on any page in Zen Cart. Common uses would be checking for a past product purchase on the product info page or shopping cart page, and doing cross-selling there.

Installation Instructions:

  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. Unzip the file you have received.
  3. 2. Copy the files below to your cart's root directory.
  4. 3. Run the script
    against your database using phpMyAdmin. If your database tables have a prefix, update this script accordingly. For example, if the value DB_PREFIX from includes/configure.php is 'zen_', change "orders" to "zen_orders" in pb.sql (Note: You cannot use Admin > Tools > Install SQL patches to run this; you must use phpMyAdmin.)
  5. For product bought : Modify your cart template files to use product_bought. For example, to display a message if product 13 has been purchased before, use
    if (product_bought(13)) { 
       echo "some message"; 
  6. For product bought within: Modify your cart template files to use product_bought_within. This function takes the following parameters:
         product id - integer 
         lookback units - string ('D' - Days, 'W' - weeks, 'M' - months)
         lookback quantity - integer 
    For example, to display a message if product 13 has been purchased in the last 10 days, use
    if (product_bought_within(13, 'D', 10)) { 
       echo "some message"; 
    Checking for the last 5 weeks would be
    if (product_bought_within(13, 'W', 5)) { 
    Checking for the last 12 months would be
    if (product_bought_within(13, 'M', 12)) { 

    Major Versions

    • 1.0 03/05/2016 - First Release

    I charge a fee of $15 for Product Bought Within and Product Bought. Buy Now!.
    The fee covers software only; installation is extra if you require help.