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

Isometric illustration of an AI answer panel citing a business website, with an AI crawler and search pages connected to it, for an AEO services guide

AEO Services: Get Cited in ChatGPT and Google AI Overviews

When a buyer asks ChatGPT, Perplexity, Gemini or Google’s AI Overviews “who builds X in India?” or “what does Y…

Shafeeq Khan
October 19, 2026
Isometric illustration of an old AI model chip being swapped for a new one in a server that powers web and mobile apps, for a GPT-4o API migration guide

GPT-4o API Shutdown: Migrate Your App Before 14 January 2027

If your chatbot, document pipeline or internal tool still calls GPT-4o or GPT-4.1, it has a deadline. On 14 October…

Shafeeq Khan
October 19, 2026
Isometric illustration of an online store connected to an AI chatbot that handles order tracking, product search, returns and hand-off to a human support agent

AI Chatbot for E-commerce Stores: Use Cases, Stack and Cost

Most store chats are the same few questions: where is my order, will this fit, can I return it. With…

Shafeeq Khan
October 18, 2026
,

Leave a Reply

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