Shopify / buy-button-js

BuyButton.js is a highly customizable UI library for adding ecommerce functionality to any website.

Home Page:http://shopify.github.io/buy-button-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get checkout url on checkout click?

cakerake opened this issue · comments

How do i get the url of the checkout page (the url that comes up in the popup)?

I want to render that page in an iframe within my website.

Hello @cakerake, I'm not entirely sure what kind of problem you're looking to solve, so here's some information on a few different solutions to get checkout-type links.

If you want a checkout link for a specific product, you can install the Buy Button channel in your Shopify Admin and then get the checkout link for the product from the checkout page.

If you're looking for pre-populated carts, take a look at the documentation for permalinks to pre-load the cart.

If you're looking to do this for different products on-the-fly, you might want to take a look at the JS Buy SDK instead of Buy Button JS. Specifically, you'll want the set of functionality around creating, updating, fetching, and completing checkouts.

In the future, please use our forums for questions around implementing features 😄

Thanks for the reply!

Here is what I’m trying to do, by using the buy button SDK I’m trying to embed my store into my website. The collection part worked fine.

When I click checkout it redirects to Shopify, instead of that if I could get the link the generated checkout link I could embed it in an iframe in a custom page

Hi @cakerake - the webUrl is currently available in the cart model and you can replace the default event handler for the checkout button with a custom event.

However, if your Buy Button components are rendered in an iFrame (that is the default behaviour) trying to get the Buy Button Cart's custom event function to access the scope of the host page might be an issue.