While SureCart provides copy/paste buy links when you create your product prices, sometimes will want to create custom purchase buttons that allow your users to purchase a product. You can even specify several different products or prices and the quantities for each. You can accomplish this using URL parameters.
Creating The Link
Finding the Price ID
The first step you will want to do is to find the “price id” that you want to use for the line item. You can do this by navigating to your Edit Product page, and clicking on “Copy Links” next to the price:
Next, click “Copy” next to the “Price ID” box:
Creating the URL
In order to add line items, you will want to use the line_items
parameter in the url. This accepts multiple options, so it will follow the format
https://yoursite.com/checkout?line_items[0][price_id]=5366e5a3
Changing the quantity
You can also specify the quantity of a line item in the url as well. This would give the line item a quantity of “2”.
https://yoursite.com/checkout?line_items[0][price_id]=5366e5a3&line_items[0][quantity]=2
Adding multiple prices
You may want to add more than a single line item to the checkout. To do that, you can do this:
https://yoursite.com/checkout?line_items[0][price_id]=5366e5a3&line_items[1][price_id]=402d8e25
You can see that we are adding an additional line_items
parameter, but instead using the “key” [0], we are using [1] to indicate it’s a separate line item.