Merge pull request #7146 from devansh-webkul/issues/6953

Fixed For Configurable And Grouped Product #6953
This commit is contained in:
Jitendra Singh 2022-11-28 16:59:03 +05:30 committed by GitHub
commit 067de38f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -497,6 +497,10 @@ abstract class AbstractType
return false;
}
if (! $this->haveSufficientQuantity(1)) {
return false;
}
return true;
}
@ -1107,7 +1111,7 @@ abstract class AbstractType
public function getCustomerGroupPricingOffers()
{
$offerLines = [];
$customerGroup = $this->customerRepository->getCurrentGroup();
$customerGroupPrices = $this->product->customer_group_prices()->where(function ($query) use ($customerGroup) {

View File

@ -178,6 +178,23 @@ class Grouped extends AbstractType
return false;
}
/**
* Is product have sufficient quantity.
*
* @param int $qty
* @return bool
*/
public function haveSufficientQuantity(int $qty): bool
{
foreach ($this->product->grouped_products as $groupedProduct) {
if ($groupedProduct->associated_product->haveSufficientQuantity($qty)) {
return true;
}
}
return false;
}
/**
* Get product minimal price.
*