From 55d2d5cfc372ee25ce3cab850bd0f43610fcf712 Mon Sep 17 00:00:00 2001 From: Ludo Date: Mon, 6 May 2024 17:09:38 +0200 Subject: [PATCH] Fix variant media not changing in the quick add modal (#3451) * Fix variant media not changing in the quick add modal * update approach based on review's feedback --- assets/global.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/global.js b/assets/global.js index e4324460f8c..3ccdd967de9 100644 --- a/assets/global.js +++ b/assets/global.js @@ -1103,8 +1103,9 @@ class VariantSelects extends HTMLElement { } updateMedia(html) { + const sectionId = this.dataset.originalSection ? this.dataset.originalSection : this.dataset.section; const mediaGallerySource = document.querySelector(`[id^="MediaGallery-${this.dataset.section}"] ul`); - const mediaGalleryDestination = html.querySelector(`[id^="MediaGallery-${this.dataset.section}"] ul`); + const mediaGalleryDestination = html.querySelector(`[id^="MediaGallery-${sectionId}"] ul`); const refreshSourceData = () => { const mediaGallerySourceItems = Array.from(mediaGallerySource.querySelectorAll('li[data-media-id]'));