Skip to content

Commit

Permalink
Enrichment bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
herzog31 committed Feb 7, 2024
1 parent 8928f90 commit ae43a6c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions blocks/enrichment/enrichment.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export default async function decorate(block) {
}

if (type === 'category') {
const categoryId = document.querySelector('.block.product-list-page')?.dataset?.category;
const plpBlock = document.querySelector('.block.product-list-page');
if (!plpBlock) return;

let categoryId = plpBlock.dataset?.category;
if (!categoryId) {
categoryId = readBlockConfig(plpBlock).category;
}
if (!categoryId) return;
filters.categories = categoryId;
}
Expand All @@ -36,7 +42,8 @@ export default async function decorate(block) {
const section = fragment.querySelector(':scope .section');
if (section) {
block.closest('.section').classList.add(...section.classList);
block.closest('.section').append(...section.childNodes);
const wrapper = block.closest('.enrichment-wrapper');
section.childNodes.forEach((child) => wrapper.parentNode.insertBefore(child, wrapper));
}
});

Expand Down

0 comments on commit ae43a6c

Please sign in to comment.