-
-
Save perrupa/5989b3dc32c0b3c194e3abb5c1c197c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const modalUrl = '/path/to/modal/contents.html'; | |
// This function is executed in the Channel's original iframe | |
function applyCallback(label) { | |
// This is the magic line here. -----\ | |
// | | |
// V | |
const modalDom = ShopifyApp.Modal.window().window.document | |
const form = modalDom.getElementById('VariantForm'); | |
SellOnAmazon.someAwesomeFunction(form); | |
ShopifyApp.Modal.close(); | |
} | |
//Called from within the Embedded App to open the modal. | |
ShopifyApp.Modal.open({ | |
src: modalUrl, | |
title: 'My Sweet EmbeddedApp Modal', | |
buttons: { | |
primary: { | |
label: 'Apply changes', | |
callback: applyCallback | |
}, | |
secondary: { | |
label: 'Cancel', | |
callback: function(label) { | |
ShopifyApp.Modal.close(); | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment