WooCommerce : Disable Repeat Purchase Of Products.


Want to sell one product only once per user?

Restrict User to buy a specific product only once in a lifetime from your WooCommerce site?

Some times in WooCommerce products we need to stop user from buying product multiple time, that means user can buy that product only once.

Depending on what kind of products you selling from your WooCommerce online store, you may want to restrict your customers from purchasing a product more than once from your online store.
May be want to disable repeat purchases for all products, or may be want to prevent repeat purchase of a specific product.

For applying any restriction first we need to check that user has already bought that product or not after that we need to disable buying ability of user for that product.

WooCommerce provide woocommerce_is_purchasable and woocommerce_variation_is_purchasable filter for setting restrictions to products.
we can apply our conditional statements in it.Both woocommerce_is_purchasable and woocommerce_variation_is_purchasable returns true and false.

And for checking user has already bought product or not we can use ‘wc_customer_bought_product’ function.

SO it’s a combination of two methods

  1. woocommerce_variation_is_purchasable filter
  2. woocommerce_is_purchasable filter
  3. ‘wc_customer_bought_product’ function
// Disable repeat purchase of WooCommerce  products / WooCommerce variations
function DisableRepeatPurchase( $purchasable, $product ) {  
  // Get ID for the current product
  $product_id = $product->get_id();  
  // return false if the customer has already bought the WooCommerce product / WooCommerce variation
  if ( wc_customer_bought_product(wp_get_current_user()->user_email, get_current_user_id(), $product_id ) ) {
    $purchasable = false;
  } 
  //check for variations: if parent is not purchasable, then variation is not
  if ( $purchasable && $product->is_type( 'variation' ) ) {
    $parent = wc_get_product( $product->get_parent_id() );
    $purchasable = $parent->is_purchasable();
  }  
  return $purchasable;
}
add_filter('woocommerce_variation_is_purchasable','DisableRepeatPurchase',99,2 );
add_filter('woocommerce_is_purchasable','DisableRepeatPurchase',99,2 );

Paste this code to your theme’s functions.php.
After this if product in already bought by user the add to cart button is disabled.
Note: If This product is already in cart then too no need to worry about it, it will automatically removed from cart page and checkout page.
Note: This will add restriction for all product. for specific product we need to need conditional statement to check product id before applying restriction.
Example:

// Disable repeat purchase of WooCommerce  products / WooCommerce variations
function DisableRepeatPurchase( $purchasable, $product ) {
  // Enter ID of the product which must be restricted for purchasing again
  $restricted = 1234;  
  // Get ID for the current product
  $product_id = $product->get_id(); 
  //Check product id with restricted product if true then restrict else return parent $purchasable value
  if ( $restricted != $product_id ) {
    return $purchasable;
  }
  // return false if the customer has already bought the WooCommerce product / WooCommerce variation
  if ( wc_customer_bought_product(wp_get_current_user()->user_email, get_current_user_id(), $product_id ) ) {
    $purchasable = false;
  } 
  //check for variations: if parent is not purchasable, then variation is not
  if ( $purchasable && $product->is_type( 'variation' ) ) {
    $parent = wc_get_product( $product->get_parent_id() );
    $purchasable = $parent->is_purchasable();
  }  
  return $purchasable;
}
add_filter('woocommerce_variation_is_purchasable','DisableRepeatPurchase',99,2 );
add_filter('woocommerce_is_purchasable','DisableRepeatPurchase',99,2 );

Related reading:

Shiv Kumawat

Executive Director & CEO

Shiv Kumawat is the CEO of Eoxys IT Solution LLP, the Jaipur-based IT company he has led since 2009. An AI & IT Solutions Consultant with 16+ years of experience, he works with startups and enterprises to turn ideas into market-ready SaaS platforms, mobile apps and AI-driven solutions. His team has delivered 700+ projects across SaaS, mobile and web apps, automation and AI. He previously served as Chief Technology Officer for a US company.

Latest Posts

AEO vs SEO vs GEO: a search bar above an AI answer panel that cites three web sources

AEO for B2B Companies: Get on ChatGPT Shortlists in 2026

A B2B buyer used to search, open ten tabs and build a shortlist over weeks. Many now ask ChatGPT, Copilot…

Shafeeq Khan
November 11, 2026
Hire an MLOps engineer illustration: a web platform with automated deployment pipelines on an isometric navy platform

Hire an MLOps Engineer: Skills, Salary and Cost in India 2026

Your data scientist built a model that works in a notebook. Three months later it is still not in production,…

Shafeeq Khan
November 10, 2026
AI visibility audit illustration: a rising search visibility chart, an eye symbol and ranked podium blocks

Track ChatGPT Traffic in GA4: AI Search Referrals in 2026

Your sales team says prospects mention ChatGPT on calls, but your analytics shows only a trickle of AI visits. Both…

Shafeeq Khan
November 9, 2026
,

Leave a Reply

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