I'm working on adding links to an e-commerce website which allow adding a product to a cart.

Given only one product, the URL is pretty straigthforward: /BuyNow/{SKU}/{Quantity}.

However, the website owners wish to be able to form links which mention several products. Which URL pattern would be the best to use in this case?

I've come with several options, but I can't say I like any of them.

  • Why are users trying to construct complicated action links by hand in the first place? Are some experienced internal users using this as a wish-it-were-an-API-drivable-from-Word?
    – Rumi P.
    Feb 10, 2014 at 11:57
  • The purpose is to use those links on promotional pages, including those on external website. This is essentially a target for the 'Buy Now' button on a promotional page, I was just thinking of how to make the resulting link look good. Honestly, it is not that much of a priority as the link would redirect the user to the cart after the products are added anyway. Just trying to make every little detail click.
    – mcm69
    Feb 10, 2014 at 12:18
  • Ah OK, maybe your wording "customers wish to be able to form links" made me misunderstand - I thought you are asking for a human-readable URL because you expect humans to create these links by hand and to type them somewhere.
    – Rumi P.
    Feb 10, 2014 at 12:20
  • Oh, sorry about that. By 'customers' I meant the website owners, as I'm a contractor. I'll edit the question to make it clearer.
    – mcm69
    Feb 10, 2014 at 12:23
  • 1
    @mcm69 if the purpose is to use those links on promotional pages, you have to make them as short as possible, you probably can't put everything in it. For example it's hard to put an url such as "thebuisness.com/…" on an ad (hard to design but also to remember). You'll probably have to shorten them to something like thebuisness.com/buynow/2ad45q
    – Gabin
    Feb 10, 2014 at 18:33

3 Answers 3


You already use the {SKU}/{Quantity} pattern, so just reuse that pattern. You can use it multiple times by simply repeating the same key in the query args:


The parameter it should be returned as a list of {SKU}/{Quantity} strings.

Note that the forward slash character is perfectly legal in a query argument per section 3.4 of http://www.ietf.org/rfc/rfc3986.txt.

  • Thanks! I ended up with almost the same solution. I'll add it as an answer for the record.
    – mcm69
    Feb 13, 2014 at 14:17

What if instead of having these be an unlabeled list of items, what if it became an item list which had a unique identifier that can be optionally named. Similar to a wishlist. That way if I want to say give you a list of things to buy for my birthday party, it will be clearly named


and if unnamed...


This will take the buyer to a page where they can review the contents of the list and add them to their cart.

  • This is a great idea ! I think OP should go for his preferred option on url pattern and shorten them as you suggest.
    – Gabin
    Feb 10, 2014 at 18:35
  • This is an awesome idea, I will definitely propose this.
    – mcm69
    Feb 13, 2014 at 14:22

Here's the pattern I ended up with:


For example,

/BuyNow/Product1 - just buy one of Product1
/BuyNow/Product1/2/Product2/3 - buy two of Product1 and three of Product2
/BuyNow/Product1/Product2/2 - one of Product1 and two of Product2

The only downside is that the parsing will not work if the SKU was a number. Thankfully, it was not an issue in my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.