WooCommerce Last Purchased

plugin banner

This is WooCommerce plugin. It shows last purchased date on each product page.

Author:Dawid UrbaƄski (profile at wordpress.org)
WordPress version required:4.0
WordPress version tested:4.4
Plugin version:1.0.1
Added to WordPress repository:28-07-2015
Last updated:24-11-2015
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:1
Plugin URI:http://wordpress.org/plugins/woocommerce-last...
Total downloads:1 460
Active installs:10+
plugin download
Click to start download

This little WooCommerce plugin shows last purchased date on single product page. It shows last purchase date made by anyone, not just current user. If current product has no sales yet, popup will not appear.

Why would I show this to my customers?

From my experience, showing last purchased date can increase conversion rate. This trick is using by Allegro (http://www.allegro.pl), biggest auction and sales website in Poland.

Basic usage

Just install plugin and you are ready to go.

Using just date in your theme (and hide popup if needed)

So you want to get last purchased date somewhere in your theme files? No problem.

First way: using WooCommerce hooks

In you function.php file paste below code.

function show_last_purchased_date(){

    if ( WLP()->last_purchased_date() ){
        echo '<div class="last-purchased-date">' . WLP()->last_purchased_text()
                . ': ' . WLP()->last_purchased_date() . '</div>';
    }

}
add_action('woocommerce_product_meta_end', 'show_last_purchased_date');

For more information about WooCommerce hooks, please visit WooCommerce documentation.

Second way: override WooCommerce template

You can achieve exact same result by overriding WooCommerce templates.

You will need to override one of WooCommerce templates. In this case we will put this information right after Add to cart button and SKU.

For more information about this, please visit WooCommerce documentation.

  1. Go to your woocommerce plugin directory.
  2. Go to templates directory.
  3. Go to single-product.
  4. Copy meta.php file to 'your_theme_directory/woocommerce/single-product/'.
  5. If you don't have such directory, create it.
  6. Now add below code just before <?php do_action( 'woocommerce_product_meta_end' ); ?>
<?php if ( WLP()->last_purchased_date() ): ?>

    <div class="last-purchased-date">
        <?php echo WLP()->last_purchased_text(); ?>:
        <?php echo WLP()->last_purchased_date(); ?>
    </div>

<?php endif; ?>

Don't show popup

In your functions.php:

function hide_wlp_popup(){

    WLP()->hide_popup = true;

}
add_action('before_wlp_init', 'hide_wlp_popup');

Styling

You can override popup styles. Just place your rules in your theme style.css file. Couple examples below.

Display popup in bottom left corner instead of bottom right

.wlp-popup{

    left: 15px;
    right: auto;
    margin-right: 15px;

}

Change background and text color

.wlp-popup{

    background: rgba(98,233,219,0.9);
    color:#0b413b;

}

Remove rounded corners, non-transparent background, no X button

.wlp-popup{

    background: #76234c;
    border-radius: 0;

}

.wlp-popup-close{

    display:none;

}

Version history

1.0.1 - Popup not appearing bug fixed 1.0 - Initial version