Merge pull request #7146 from devansh-webkul/issues/6953
Fixed For Configurable And Grouped Product #6953
This commit is contained in:
commit
067de38f9e
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue