Have you ever wanted to know how many people have checked out your product? You’re in luck because in this video, we’ll show you how to add the number of people who have checked out your product on WooCommerce.
WooCommerce php snippet – how many viewed the product with php snippet is allowing customer and the admin know how many customers or visitors have clicked and checked the product. Learn how to add the feature to your ecommerce website.
see attached YouTube tutorial for more info on how to implement it.
Attached is a YouTube tutorial explaining how to add the code.
Feature we are adding to our ecommerce website:
Use the php attached below to add the feature to your ecommerce website.
/**
* Author: Thiarara
* Version: 1.1 1
* licence: Free GPL
* Topic: How many customer checked the product.
* Email support: contact@thiarara.co.ke
**/
function people_viewing_product_shortcode() {
// The random number shown will be bewtween 15 and 30.
$product_views = (mt_rand(15,30));
return '❤️️' . $product_views . 'checked and Loved the product!';
}
add_shortcode('people_viewing_product', 'people_viewing_product_shortcode');
function action_woocommerce_after_add_to_cart_form( ) {
echo do_shortcode('[people_viewing_product]');
};