How to Disable Repeat Purchase for a WooCommerce Product?

Do you want to display repeat purchase for a WooCommerce product?

In WooCommerce, it’s common to allow repeat purchases for physical products or virtual products like courses and eBooks. However, there are scenarios where you might want to disable repeat purchases for certain products to avoid confusion, improve the customer experience, and protect your business.

For instance, if a customer buys an eBook, course, or limited edition product, you may want to prevent them from purchasing it again within a certain time frame, such as one year.

By restricting repeat purchases in WooCommerce, you can notify your customers that they’ve already bought the product, thereby enhancing their shopping experience and maintaining trust in your brand.

Why Disable Repeat Purchase for a WooCommerce Product?

Disabling repeat purchases in WooCommerce can be beneficial in various scenarios. Here are some compelling reasons why you might want to disable repeat purchases for certain products in your WooCommerce store:

1. Prevent Duplicate Purchases for Digital Products

For digital downloads like eBooks, courses, software, or licenses, customers usually need to purchase these products only once. Allowing repeat purchases can lead to accidental double purchases, which may result in refund requests, customer frustration, and extra customer support work.

By disabling repeat purchases, you ensure that customers don’t unintentionally buy the same digital product multiple times

2. Avoid Confusion for One-Time Purchases

Certain physical products or services are only meant to be purchased once. For example, subscription services, memberships, or products like event tickets typically don’t need to be bought repeatedly. Allowing multiple purchases of these products can confuse customers and lead to issues with fulfillment or delivery.

3. Protect Your Business from Inventory Management Issues

If you sell limited-edition products or items with restricted availability, allowing repeat purchases may result in a few customers hoarding your inventory.

This can deprive other customers of the chance to purchase and create dissatisfaction. By restricting repeat purchases, you can ensure fair distribution and better control over your stock.

4. Improve Customer Experience and Build Trust

Customers appreciate it when businesses take steps to avoid mistakes on their behalf. If a customer tries to purchase a product they already own, displaying a friendly message letting them know about their prior purchase builds trust.

It shows that you care about their experience and prevents potential frustration from duplicated purchases or unnecessary costs.

6. Reduce Refund Requests and Chargebacks

Customers who accidentally purchase the same product multiple times are more likely to request refunds or file chargebacks.

This not only creates extra work for your support team but can also affect your business’s financial standing. By preventing repeat purchases, you reduce the likelihood of refunds and the administrative burden that comes with them.

7. Simplify Subscription Management

If you sell subscription-based products, like online services or memberships, repeat purchases can interfere with your billing cycles and subscription management.

By preventing customers from purchasing the same subscription multiple times, you can ensure a more straightforward, error-free process.

How to Disable Repeat Purchases for a WooCommerce Product?

Use the code snippet below to disable repeat purchases for a WooCommerce product. Make sure you replace the product ID in the code below with your desired product.

php
/**
 * Disables repeat purchase for a specific WooCommerce product
 * 
 * @param bool $purchasable true if product can be purchased
 * @param \WC_Product $product the WooCommerce product
 * @return bool $purchasable the updated is_purchasable check
 */
function maverick_disable_woocommerce_product_repeat_purchase($purchasable, $product)
{

	// Enter the ID of the product that shouldn't be purchased again
	$exclude_product_id = 303;

	// Get the ID for the current product (passed in)
	$product_id = $product->get_id();

	// Bail unless the ID is equal to our desired non-purchasable product
	if ($exclude_product_id !== $product_id) {
		return $purchasable;
	}

	// return false if the customer has bought the product
	if (wc_customer_bought_product(get_current_user()->user_email, get_current_user_id(), $product_id)) {
		$purchasable = false;
	}

	return $purchasable;
}

add_filter('woocommerce_variation_is_purchasable', 'maverick_disable_woocommerce_product_repeat_purchase', 10, 2);
add_filter('woocommerce_is_purchasable', 'maverick_disable_woocommerce_product_repeat_purchase', 10, 2);

Leave a Reply

Your email address will not be published. Required fields are marked *