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

Colour photograph illustrating the Eoxys blog post 'Computer-Use AI Agents: Automate Old Software Without an API', used as the featured image for computer use ai agents.

Computer-Use AI Agents: Automate Old Software Without an API

Every business has a task like this: an employee logs into a government portal, a supplier site or a 15-year-old…

Shafeeq Khan
November 16, 2026
Colour photograph illustrating the Eoxys blog post 'Product Feed Optimization for ChatGPT Shopping and AI Mode', used as the featured image for product feed optimization ai shopping.

Product Feed Optimization for ChatGPT Shopping and AI Mode

When a shopper asks ChatGPT or Google AI Mode for “the best running shoes under ₹6,000 for flat feet”, the…

Shafeeq Khan
November 15, 2026
Colour photograph illustrating the Eoxys blog post 'Hire an AI Product Manager: Skills, Salary and When You Need One', used as the featured image for hire ai product manager.

Hire an AI Product Manager: Skills, Salary and When You Need One

Your team can call a model API in an afternoon. Deciding what the AI feature should do, how good is…

Shafeeq Khan
November 14, 2026
,

Leave a Reply

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