How should I use the message parameter of EAS buttons?

Highlighted
Shopify Partner
30 0 1

Hi,

NB: I am a EAS and JavaScript rookie, so the question I ask here is very basic.

Originally my page had a form with only a button, and the action was a post action directing to a subpage:

<form action='doStuff' method='post'>

Now I want to replace this with a Shopify Bar button:

ShopifyApp.ready(function(){
  ShopifyApp.Bar.initialize({
      buttons: {
          primary: {
            label: "Do stuff",
            message: '<what should I put here?>'
          }
        }
  });
});

 

For the message I have tried:

message: 'doStuff'

message: '/doStuff'

without luck.

 

I solved it for now by adding the href parameter with the absolute URL, but is that the best way to do it, or should I be able to use the message parameter instead?

 

Thanks,

-Louise

message 

0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
46 0 3

Hi Louise,

 

Setting the href attribute is the way to go. When the href attribute is set, it will automatically create an associated message attribute value. If the link you’re setting is an app link or external from Shopify, it should be absolute. 

 

Hope this helps,

Kristina

0 Likes