commerce
commerce copied to clipboard
[3.x]: hasSales attribute not filtering out items that are not promotable
What happened?
Description
I have a weird issue where items that are not promotable are showing up when I use the hasSales attribute set to true on a variant query:
{% paginate craft.products({
relatedTo: params,
limit: 15,
order: 'sku asc',
with: [['frontImage', {withTransforms: ['viewAll']}]],
hasVariant: variantQuery
}) as pageInfo, products %}
{% set variantQuery = {
hasStock: true,
hasSales: saleItems ? true : false
} %}
I have a query parameter that is being passed from the frontend to determine if the user is looking for on sale items or not
Steps to reproduce
Expected behavior
Expect that returned results will all have active sales when user requests "sales items"
Actual behavior
Showing all items related to their filtered query
Craft CMS version
3.9.5
Craft Commerce version
3.4.23
PHP version
7.4
Operating system and version
No response
Database type and version
No response
Image driver and version
No response