diff --git a/packages/Webkul/Product/src/Type/AbstractType.php b/packages/Webkul/Product/src/Type/AbstractType.php index 5de9f9260..186a230a3 100644 --- a/packages/Webkul/Product/src/Type/AbstractType.php +++ b/packages/Webkul/Product/src/Type/AbstractType.php @@ -980,4 +980,20 @@ abstract class AbstractType return $offerLines; } + + /** + * Check in loaded saleable. + * + * @return object + */ + public function checkInLoadedSaleableChecks($product, $callback) + { + static $loadedSaleableChecks = []; + + if (array_key_exists($product->id, $loadedSaleableChecks)) { + return $loadedSaleableChecks[$product->id]; + } + + return $loadedSaleableChecks[$product->id] = $callback($product); + } } \ No newline at end of file