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

Food delivery app development cost in the UK: delivery rider with an insulated bag and a takeaway order at a townhouse door

Food Delivery App Development Cost in the UK (2026)

A food delivery order in the UK succeeds or fails in about forty minutes: the kitchen has to accept it…

Shafeeq Khan
December 1, 2026
Colour photograph illustrating the Eoxys blog post 'Year-End AEO Checklist: Get Ready for AI Search in 2027', used as the featured image for year end aeo checklist.

Year-End AEO Checklist: Get Ready for AI Search in 2027

December is a good time to check whether your website is ready for how people search in 2027. AI answers…

Shafeeq Khan
December 1, 2026
Logistics app development cost in Canada: smiling delivery driver in a red uniform at the wheel of a white van

Logistics App Development Cost in Canada (2026)

A courier app in Canada earns its keep in the moments nobody demos: the driver who loses signal in a…

Shafeeq Khan
November 30, 2026
,

Leave a Reply

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