SyliusPickupPointPlugin icon indicating copy to clipboard operation
SyliusPickupPointPlugin copied to clipboard

Js label fetcher is missing

Open ehibes opened this issue 2 years ago • 0 comments

This issue is detailed here as well : https://github.com/Setono/SyliusPickupPointPlugin/pull/50#issuecomment-851886998 The following piece of code fixes that, but I think it should be in the main asset too.

document.addEventListener('DOMContentLoaded', () => {
    document.querySelectorAll('.setono-sylius-pickup-point-label').forEach((elt) => {
        fetch(elt.dataset.url)
            .then((response) => response.json())
            .then((response) => {
                elt.innerHTML = `<strong>Livraison point relais</strong><br/>
                ${response.name}<br/>
                ${response.full_address}<br/>
                `
                elt.style.display = 'block';
            })
    })
}) 

ehibes avatar Apr 03 '23 19:04 ehibes