{"_id":"58112e72ded0340f0085d04d","user":"56439928549c4d0d00d7e910","version":{"_id":"58112e71ded0340f0085d02a","project":"551e85be610f400d00837db7","__v":4,"createdAt":"2016-10-26T22:30:09.862Z","releaseDate":"2016-10-26T22:30:09.862Z","categories":["58112e72ded0340f0085d02b","58112e72ded0340f0085d02c","58112e72ded0340f0085d02d","58112e72ded0340f0085d02e","58112e72ded0340f0085d02f","58112e72ded0340f0085d030","58112e72ded0340f0085d031","58112e72ded0340f0085d032","58112e72ded0340f0085d033","58112e72ded0340f0085d034","581137cc604d3c230048b7e4","58dc367221742d0f00a73f98","590768e54669da0f00db5c0b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"new designer","version_clean":"2.0.0","version":"2.0"},"__v":0,"category":{"_id":"58112e72ded0340f0085d030","version":"58112e71ded0340f0085d02a","project":"551e85be610f400d00837db7","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-25T20:14:44.667Z","from_sync":false,"order":4,"slug":"store-api-methods","title":"Store API Methods"},"project":"551e85be610f400d00837db7","parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-11T19:47:03.130Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"With these URL endpoints, you can link a customer from anywhere on the web directly to a specific point in the subscription flow or a pre-filled cart.\n\n# Subscription Flow URLs\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    http://yoursite.com/subscribe/productId_Product+Name[/variantId_Variant+Name]\\n  </span>\\n</div>\"\n}\n[/block]\nLinks to a specific point in the new subscription flow.\n\nThis url includes the id of the subscription product you would like to link to. If you have multiple variants or terms for the product then you will also need to include those ids in the url. These ids can be found in the merchant dashboard.\n\nIf you have variants or multiple terms for your product but you do not include that information in the URL the customer will be prompted to select the unspecified variants or terms.\n\n\nExample for a product with id `12345` and a variant id `789`:\n```\n/subscribe/12345_Red+Apple/789_pack+of+four\n```\n[block:callout]\n{\n  \"type\": \"success\",\n  \"body\": \"The easiest way to get the exact URL you are looking for is to simply go through your own subscribe flow on your store and copy the URL in the address bar for the point you want to link to.\",\n  \"title\": \"Tip\"\n}\n[/block]\n# One-time product cart URLs\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    http://yoursite.com/buy/prod1[+prod2+ &hellip; prodN]\\n  </span>\\n</div>\"\n}\n[/block]\nRedirects a user to a preconfigured cart with the specified products with optionally specified quantities.\n\nEach `prodN` should be of the form `SKU~QTY` where `SKU` is the SKU for the product variant found in the merchant dashboard. `~QTY` is optional (defaults to 1) and should be an integer value. For example: *http://yoursite.com/buy/SKU1234~1* \n[block:callout]\n{\n  \"type\": \"danger\",\n  \"body\": \"This method will fail if more than one product variant in your store matches one of SKU supplied to this endpoint.\",\n  \"title\": \"SKUs must be unique\"\n}\n[/block]","excerpt":"","slug":"add-to-cart-urls","type":"basic","title":"Add-to-cart URLs"}
With these URL endpoints, you can link a customer from anywhere on the web directly to a specific point in the subscription flow or a pre-filled cart. # Subscription Flow URLs [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n http://yoursite.com/subscribe/productId_Product+Name[/variantId_Variant+Name]\n </span>\n</div>" } [/block] Links to a specific point in the new subscription flow. This url includes the id of the subscription product you would like to link to. If you have multiple variants or terms for the product then you will also need to include those ids in the url. These ids can be found in the merchant dashboard. If you have variants or multiple terms for your product but you do not include that information in the URL the customer will be prompted to select the unspecified variants or terms. Example for a product with id `12345` and a variant id `789`: ``` /subscribe/12345_Red+Apple/789_pack+of+four ``` [block:callout] { "type": "success", "body": "The easiest way to get the exact URL you are looking for is to simply go through your own subscribe flow on your store and copy the URL in the address bar for the point you want to link to.", "title": "Tip" } [/block] # One-time product cart URLs [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n http://yoursite.com/buy/prod1[+prod2+ &hellip; prodN]\n </span>\n</div>" } [/block] Redirects a user to a preconfigured cart with the specified products with optionally specified quantities. Each `prodN` should be of the form `SKU~QTY` where `SKU` is the SKU for the product variant found in the merchant dashboard. `~QTY` is optional (defaults to 1) and should be an integer value. For example: *http://yoursite.com/buy/SKU1234~1* [block:callout] { "type": "danger", "body": "This method will fail if more than one product variant in your store matches one of SKU supplied to this endpoint.", "title": "SKUs must be unique" } [/block]