Skip to content

Commit

Permalink
Fix variant media not changing in the quick add modal (Shopify#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 authored May 6, 2024
1 parent c60a5f3 commit bef28ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion assets/global.js
Original file line number Diff line number Diff line change
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 bef28ad

Please sign in to comment.