Shopify Buy Button - buttonDestination: onlineStore not working

Solved
PMWcom
New Member
2 1 0

Hi there,

I am trying to create a buy button to embed on a clients website which links the products in the collection through to the actual Shopify store rather than having the cart and modal popups. From what I can tell via the documentation here: https://shopify.github.io/buy-button-js/customization/ This should be possible via:

Product Attributes buttonDestination

  • ‘cart’ Adds product to cart and opens cart
  • ‘modal’ Opens a modal window with further details about the product
  • ‘checkout’ Opens a pop-up window directly to checkout
  • ‘onlineStore’ Open product in your online store (Note: requires Online Store channel be active and product be visible in Online Store)

Type: String: 'cart', 'modal', 'checkout', 'onlineStore'

Default value: 'cart'

However when I set this option in the config and click the View Product button it opens a new tab with the following: 

https://<hostname><currentpage>/null?channel=buy_button&referrer=http%3A%2F%2F<hostname>%2F<currentpage>%2F&variant=XXXX

Any ideas what is going on - does this only work for particular types of embed? 

Any help would be appreciated.

0 Likes
PMWcom
New Member
2 1 0

This is an accepted solution.

After spending some time looking into this - the Shopify SDK uses the onlineStoreUrl method on the product and in the docs it says the following:

 

onlineStoreUrl (URL)

The online store URL for the product. A value of null indicates that the product is not published to the Online Store sales channel.

 

The site is currently in development and although the product is live on the development store I assume it is returning Null because it is not possible to view the product on the store at this time.

Hope this helps someone if they have the same issue.

0 Likes
djevox
Tourist
5 0 1

How did you get around this? 

0 Likes