Send value to iframe


I have been try to send a value to iframe (the cart id of the user), I have been used the basic structure of iframe.

"store.custom#about-us": {
    "blocks": [

  "iframe": {
    "props": {
      "src": ""

It works weel. But i don’t have fine the way to send this value to my external page who is open in the iframe. also this page was build in html, css and js.

Hi there,

You can try like this, in DOM you’ve got some methods on document getting the attributes from elements using a selector for e.g.

const element = document.getElementsByName("img");
const value = element.getAttribute("src");
console.log("My value = ", value); // this value you can declare global or store in localStorage
// I would try to use the same method to get from the DOM this value inside iframe

By the way you’ve opened already a duplicate thread: How to add Cart button on iframe - #4 by sirev

1 Like