diff --git a/vendor/magento/module-visual-merchandiser/Model/Resolver/QuantityAndStock.php b/vendor/magento/module-visual-merchandiser/Model/Resolver/QuantityAndStock.php
index 78f1cecb47f..dc165803d2d 100644
--- a/vendor/magento/module-visual-merchandiser/Model/Resolver/QuantityAndStock.php
+++ b/vendor/magento/module-visual-merchandiser/Model/Resolver/QuantityAndStock.php
@@ -7,9 +7,12 @@ declare(strict_types=1);

 namespace Magento\VisualMerchandiser\Model\Resolver;

+use Magento\Catalog\Api\Data\ProductInterface;
 use Magento\Catalog\Model\ResourceModel\Product\Collection;
 use Magento\CatalogInventory\Model\Stock;
 use Magento\Framework\App\Helper\AbstractHelper;
+use Magento\Framework\App\Helper\Context;
+use Magento\Framework\EntityManager\MetadataPool;
 use Magento\Framework\Exception\LocalizedException;

 /**
@@ -17,6 +20,21 @@ use Magento\Framework\Exception\LocalizedException;
  */
 class QuantityAndStock extends AbstractHelper
 {
+    /**
+     * @var MetadataPool
+     */
+    private $metadataPool;
+
+    /**
+     * @param Context $context
+     * @param MetadataPool $metadataPool
+     */
+    public function __construct(Context $context, MetadataPool $metadataPool)
+    {
+        parent::__construct($context);
+        $this->metadataPool = $metadataPool;
+    }
+
     /**
      * Joins stock information
      *
@@ -26,11 +44,13 @@ class QuantityAndStock extends AbstractHelper
      */
     public function joinStock(Collection $collection): Collection
     {
+        $productLinkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
+
         $collection->joinField(
             'child_id',
             $collection->getTable('catalog_product_relation'),
             'child_id',
-            'parent_id=entity_id',
+            'parent_id=' . $productLinkField,
             null,
             'left'
         );
diff --git a/vendor/magento/module-visual-merchandiser/Model/Rules/Rule/QuantityAndStockStatus.php b/vendor/magento/module-visual-merchandiser/Model/Rules/Rule/QuantityAndStockStatus.php
index b44872ca588..ec7f546fc39 100644
--- a/vendor/magento/module-visual-merchandiser/Model/Rules/Rule/QuantityAndStockStatus.php
+++ b/vendor/magento/module-visual-merchandiser/Model/Rules/Rule/QuantityAndStockStatus.php
@@ -6,7 +6,10 @@

 namespace Magento\VisualMerchandiser\Model\Rules\Rule;

+use Magento\Catalog\Api\Data\ProductInterface;
+use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
 use Magento\Catalog\Model\ResourceModel\Product\Collection;
+use Magento\Framework\EntityManager\MetadataPool;
 use Magento\Framework\Exception\LocalizedException;

 /**
@@ -14,6 +17,22 @@ use Magento\Framework\Exception\LocalizedException;
  */
 class QuantityAndStockStatus extends \Magento\VisualMerchandiser\Model\Rules\Rule
 {
+    /**
+     * @var MetadataPool
+     */
+    private $metadataPool;
+
+    /**
+     * @param array $rule
+     * @param Attribute $attribute
+     * @param MetadataPool $metadataPool
+     */
+    public function __construct(array $rule, Attribute $attribute, MetadataPool $metadataPool)
+    {
+        parent::__construct($rule, $attribute);
+        $this->metadataPool = $metadataPool;
+    }
+
     /**
      * Applying the rules to the collection
      *
@@ -23,11 +42,13 @@ class QuantityAndStockStatus extends \Magento\VisualMerchandiser\Model\Rules\Rul
      */
     public function applyToCollection($collection)
     {
+        $productLinkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
+
         $collection->joinField(
             'child_id',
             $collection->getTable('catalog_product_relation'),
             'child_id',
-            'parent_id=entity_id',
+            'parent_id=' . $productLinkField,
             null,
             'left'
         );
