Skip to content

Commit

Permalink
Fix variant media not changing in the quick add modal (#3451)
Browse files Browse the repository at this point in the history
* Fix variant media not changing in the quick add modal

* update approach based on review's feedback
  • Loading branch information
ludoboludo committed May 6, 2024
1 parent d627f21 commit 55d2d5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion assets/global.js
Expand Up @@ -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]'));
Expand Down

0 comments on commit 55d2d5c

Please sign in to comment.