Question:
Wix Store Placeholder not working properly with Embedded Script
Product:
Wix Editor, Wix Dev App
What are you trying to achieve:
I am trying to create a widget for Wix Store product page and using Embedded Script to add it to Product Page’s Placeholder
What have you already tried:
I am using only available document for Embed Script : https://dev.wix.com/docs/build-apps/developer-tools/extensions/embedded-scripts#embedded-script-placeholders
Additional information:
Here is my embed script:
<script>
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM Content Loaded");
try {
let element = document.querySelector('[data-hook="details-placeholder"]');
const para = document.createElement("p");
const node = document.createTextNode("This is a paragraph.");
para.appendChild(node);
element.appendChild(para);
} catch (e) {
console.log(e);
}
});
</script>
Problem is that Element will appear and disapper within few seconds: