Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove check quantity method from ProductVariant model

Mira Szewczyk8db134a99cb1
diff --git a/saleor/product/models.py b/saleor/product/models.py
index 1d15448e05..222821b9b2 100644
--- a/saleor/product/models.py
+++ b/saleor/product/models.py
@@ -24,7 +24,6 @@ from text_unidecode import unidecode
from versatileimagefield.fields import PPOIField, VersatileImageField
from ..core.db.fields import SanitizedJSONField
-from ..core.exceptions import InsufficientStock
from ..core.models import (
ModelWithMetadata,
PublishableModel,
@@ -480,14 +479,6 @@ class ProductVariant(ModelWithMetadata):
def is_available(self) -> bool:
return self.is_visible and self.is_in_stock()
- def check_quantity(self, quantity):
- """Check if there is at least the given quantity in stock.
-
- If stock handling is disabled, it simply run no check.
- """
- if self.track_inventory and quantity > self.quantity_available:
- raise InsufficientStock(self)
-
@property
def base_price(self) -> "Money":
return (