Skip to content

fix(administration): reset the canonical product of duplicated variants - #21292

Merged
Vin Le (vienthuong) merged 3 commits into
shopware:trunkfrom
M-arcus:fix/admin-product-clone-variant-canonical
Oct 9, 2026
Merged

Vin Le (vienthuong) merged 3 commits into
shopware:trunkfrom
M-arcus:fix/admin-product-clone-variant-canonical

Conversation

@M-arcus

Copy link
Copy Markdown
Contributor

1. Why is this change necessary?

When a product is duplicated in the Administration, a variant that stores its own canonical product keeps it, so the copy's variant page names the original product's variant as its canonical URL. Search engines are then told that the copy is a duplicate of the original. #13292 resets canonicalProductId when the parent is cloned, but the variants are cloned one by one afterwards and only get a new parentId and product number.

(The author of #13292 really should've thought of that)

2. What does this change do, exactly?

Duplicated variants no longer keep a canonical product of their own. They inherit the canonical of the new parent product, which the duplicate already resets, so no page of the copy points to the original product.

3. Describe each step to reproduce the issue or behaviour.

  1. Create a product with two variants, A and B, and set the canonical product of variant A itself to variant B (via the Admin API, e.g. PATCH /api/product/<A> with {"canonicalProductId": "<B>"}).
  2. Open the parent in the Administration and use "Save and duplicate".
  3. Check the copy's variant A (canonicalProductId in the Admin API, or <link rel="canonical"> on its storefront page).
    • Before: it points to variant B of the original product.
    • After: it is empty, and the page uses its own URL as canonical.

4. Please link to the relevant issues (if any).

#13292

5. Checklist

  • I have written tests and verified that they fail without my change
  • I have updated developer-facing release notes if this change is relevant for external developers:
    • Add a short entry to RELEASE_INFO-6.<major>.md under “Upcoming” for informational changes, including the consequences of the change and how it affects external developers.
    • Add an UPGRADE section in UPGRADE-6.<next-major>.md for breaking changes (what/why/impact/how to adapt).
    • See the Documenting a Release Process for details.
  • I have written or adjusted the documentation and agent skills according to my changes
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I have read the contribution requirements and fulfilled them

@github-actions github-actions Bot added the external-contribution A PR contributed by a community member. label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor
Warnings
⚠️ The Pull Request doesn't contain any release info, if your changes are relevant for external developers please add an entry to the release info file, including the consequences of the change and how it affects external developers. For detailed infos please refer to the [release documentation guide](https://github.com/shopware/shopware/blob/trunk/delivery-process/documenting-a-release.md).

@explore-openapi

explore-openapi Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

OpenAPI Snapshot

ℹ️ shopware/store-api — schema identical to base trunk

ℹ️ shopware/admin-api — schema identical to base trunk

@github-actions github-actions Bot added needs-triage A newly created issue or PR that needs team assignment and/or prioritization. waiting-on/shopware The PR is waiting on shopware. Set daily by the waiting-on-report workflow. labels Oct 6, 2026
@mitelg Michael Telgmann (mitelg) added domain/inventory Responsible for managing products and everything product-related and removed needs-triage A newly created issue or PR that needs team assignment and/or prioritization. labels Oct 8, 2026
@mitelg
Michael Telgmann (mitelg) requested a review from a team October 8, 2026 09:30

@sydinh Sy Dinh (sydinh) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks 👍🏻 💙

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.23%. Comparing base (9f1d908) to head (810c1c3).

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #21292   +/-   ##
=======================================
  Coverage   71.23%   71.23%           
=======================================
  Files        5896     5896           
  Lines      216750   216750           
  Branches    12035    12035           
=======================================
+ Hits       154397   154402    +5     
+ Misses      58527    58523    -4     
+ Partials     3826     3825    -1     
Flag Coverage Δ
jest-admin 68.38% <ø> (+<0.01%) ⬆️
jest-storefront 72.00% <ø> (ø)
vitest-storefront-components 57.92% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vienthuong
Vin Le (vienthuong) added this pull request to the merge queue Oct 9, 2026
@vienthuong

Copy link
Copy Markdown
Contributor

The change LGTM, thank you for your contribution Marcus Müller (@M-arcus) 🎉

Merged via the queue into shopware:trunk with commit e1500ab Oct 9, 2026
9 checks passed
@github-actions github-actions Bot added this to the 6.7.16.0 milestone Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/inventory Responsible for managing products and everything product-related external-contribution A PR contributed by a community member. milestone/6.7.16.0 waiting-on/shopware The PR is waiting on shopware. Set daily by the waiting-on-report workflow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants