Issue regarding APP bridge modal

Issue regarding APP bridge modal

Edmond_A_
Shopify Partner
1 0 0

We have facing an issue with the modal appbridge

In our app, all the actions are working properly but only modal are not working.we have set modal action on the button click event 

here is code,

<a class="add-shopify uppercase" href="#" data-product-id="0000" onclick="return addtoshopify('0000')">Add</a>

<script src="https://unpkg.com/@shopify/app-bridge@1" async></script>
<script src="https://unpkg.com/@shopify/app-bridge@0.8.2/actions.js"></script>
<script src="https://unpkg.com/@shopify/app-bridge@1.6/umd/index.development.js"></script>
<script>
var AppBridge = window['app-bridge'];
var actions = AppBridge.actions;
var createApp = AppBridge.default;

var ShopifyApp = createApp({
apiKey: '<?php echo SHOPIFY_API_KEY; ?>',
shopOrigin: '<?php echo $_SESSION['shop']; ?>',
debug: false,
forceRedirect: false,
allowfullscreen: true
});
var Button = actions.Button;
var TitleBar = actions.TitleBar;
var Modal = actions.Modal;

function addtoshopify(id){
var Modal = actions.Modal;
var modalOptions = {
title: 'My Modal',
message: 'Hello world!',
};
var myModal = Modal.create(ShopifyApp, modalOptions);

myModal.dispatch(Modal.Action.OPEN);

}

</script>

Replies 0 (0)