File tree Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 11# Release Notes for Craft Commerce
22
3+ ## Unreleased
4+
5+ - Fixed a bug where newly created variants weren’t visible on Edit product screens.
6+ - Fixed a SQL error that could occur when viewing product indexes.
7+
38## 5.5.0.1 - 2025-11-24
49
510- Fixed an error that could occur when querying for products via GraphQL. ([ #4122 ] ( https://github.com/craftcms/commerce/issues/4122 ) )
Original file line number Diff line number Diff line change @@ -715,9 +715,19 @@ public function updateSku(Product $product): void
715715 */
716716 protected function cacheTags (): array
717717 {
718- return [
719- "product: $ this ->primaryOwnerId " ,
720- ];
718+ $ tags = [];
719+
720+ if ($ primaryOwnerId = $ this ->getPrimaryOwnerId ()) {
721+ $ tags [] = "element:: {$ primaryOwnerId }" ;
722+ $ tags [] = "product: {$ primaryOwnerId }" ;
723+ }
724+
725+ $ ownerId = $ this ->getOwnerId ();
726+ if ($ ownerId && $ ownerId !== $ primaryOwnerId ) {
727+ $ tags [] = "element:: {$ ownerId }" ;
728+ }
729+
730+ return $ tags ;
721731 }
722732
723733 /**
@@ -1181,7 +1191,7 @@ public function beforeSave(bool $isNew): bool
11811191 // Validate shipping category ID is available for this product type
11821192 $ availableShippingCategories = $ this ->availableShippingCategories ();
11831193 $ availableShippingCategoryIds = ArrayHelper::getColumn ($ availableShippingCategories , 'id ' );
1184-
1194+
11851195 // If the current shipping category ID is not in the available categories, set it to the default one
11861196 $ currentShippingCategoryId = $ this ->getShippingCategoryId ();
11871197 if (!in_array ($ currentShippingCategoryId , $ availableShippingCategoryIds )) {
Original file line number Diff line number Diff line change 2020use craft \db \Query ;
2121use craft \db \QueryAbortedException ;
2222use craft \db \Table as CraftTable ;
23+ use craft \elements \db \NestedElementQueryTrait ;
2324use craft \helpers \ArrayHelper ;
2425use craft \helpers \Db ;
2526use craft \helpers \StringHelper ;
5657 */
5758class VariantQuery extends PurchasableQuery
5859{
60+ use NestedElementQueryTrait {
61+ cacheTags as nestedTraitCacheTags;
62+ }
5963 /**
6064 * @inheritdoc
6165 */
@@ -484,7 +488,7 @@ protected function beforePrepare(): bool
484488 // Forcing the use of the `sortOrder` index if no custom `orderBy` is set
485489 if ($ sortOrderIndex !== null && empty ($ this ->orderBy )) {
486490 $ elementOwnersTable = Craft::$ app ->getDb ()->schema ->getRawTableName (\craft \db \Table::ELEMENTS_OWNERS );
487- $ this ->subQuery ->innerJoin ([new Expression ('[[ ' . $ elementOwnersTable. ']] AS elements_owners USE INDEX ( ' . $ sortOrderIndex . ') ' )], $ ownersCondition );
491+ $ this ->subQuery ->innerJoin ([new Expression ('[[ ' . $ elementOwnersTable . ']] AS elements_owners USE INDEX ( ' . $ sortOrderIndex . ') ' )], $ ownersCondition );
488492 } else {
489493 $ this ->subQuery ->innerJoin (['elements_owners ' => CraftTable::ELEMENTS_OWNERS ], $ ownersCondition );
490494 }
@@ -874,6 +878,8 @@ protected function cacheTags(): array
874878 }
875879 }
876880
881+ array_push ($ tags , ...$ this ->nestedTraitCacheTags ());
882+
877883 return $ tags ;
878884 }
879885}
You can’t perform that action at this time.
0 commit comments