Skip to content

Commit

Permalink
fix: Excluded disabled variants from minimum price calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmolinacano committed Nov 10, 2024
1 parent bf9594d commit 52ac3a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Helper/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Catalog\Model\Product\Type as ProductType;
use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable as ConfigurableType;
use Magento\Downloadable\Model\Product\Type as DownloadableType;
use Magento\GroupedProduct\Model\Product\Type\Grouped as GroupedType;
Expand Down Expand Up @@ -195,6 +196,11 @@ private function getMinimumComplexProductPrice($product, $usedProds, $type)
$minimum_price = null;
$minimum_variant = null;

// To exclude disabled variants from the calculations
$usedProds = array_filter($usedProds, function($child) {
return Status::STATUS_ENABLED === (int)$child->getStatus();
});

/*
We identify the variant with the minimum final price (or price), and
that is the one that is used to obtain the requested price for the
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "doofinder/doofinder-magento2",
"version": "0.14.13",
"version": "0.14.14",
"description": "Doofinder module for Magento 2",
"type": "magento2-module",
"require": {
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Doofinder_Feed" setup_version="0.14.13">
<module name="Doofinder_Feed" setup_version="0.14.14">
<sequence>
<module name="Magento_Integration" />
</sequence>
Expand Down

0 comments on commit 52ac3a6

Please sign in to comment.