Converting to Add to Cart Button (PayPal)

paypal300 While talking with a pro bono client today they were wondering how hard it would be to add an “add to cart” button instead of a single item “buy now” button on their site.  At the time their website was developed (approximately 7 years ago) they only offered one item for sale. 

Of course 7 years later they now have 5 items they sell online.  Currently the solution is not setup to add items to cart but after doing a little bit of research today, it’s not hard to covert those… This is an example of what the “single purchase button” is coded…

   1: <form method="post" action="https://www.paypal.com/cgi-bin/webscr">
   2: <input type="hidden" name="cmd" value="_xclick">
   3: <input type="hidden" name="business" value="payments@yoursite.com">
   4: <input type="hidden" name="item_name" value="Baseball Hat">
   5: <input type="hidden" name="item_number" value="123">
   6: <input type="hidden" name="amount" value="5.95">
   7: <input type="hidden" name="shipping" value="1.00">
   8: <input type="hidden" name="shipping2" value="0.50">
   9: <input type="hidden" name="handling" value="2.00">
  10: <input type="hidden" name="currency_code" value="USD">
  11: <input type="hidden" name="return" value="http://www.yoursite.com/thankyou.htm">
  12: <input type="hidden" name="undefined_quantity" value="1">
  13: <input type="image" src="http://images.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" width="68" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
  14: </form>

The first step to converting the button is to add this to the form tag:

   1: <form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal">

The next thing you will want to do is to locate this line of code:

   1: <input type="hidden" name="cmd" value="_xclick">

and replace it with this:

   1: <input type="hidden" name="cmd" value="_cart">

This line will also need to be added to the form tag:

   1: <input type="hidden" name="add" value="1">

Then you will want to locate the input-type-image area and replace that code with this:

   1: <input type="image" src="http://images.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!">

The finished product once you have finished inputting everything and swapping out these snippets of code should look something like this:

   1: <form method="post" action="https://www.paypal.com/cgi-bin/webscr">
   2: <input type="hidden" name="cmd" value="_cart">
   3: <input type="hidden" name="add" value="1">
   4: <input type="hidden" name="business" value="payments@yoursite.com">
   5: <input type="hidden" name="item_name" value="Baseball Hat">
   6: <input type="hidden" name="item_number" value="123">
   7: <input type="hidden" name="amount" value="5.95">
   8: <input type="hidden" name="shipping" value="1.00">
   9: <input type="hidden" name="shipping2" value="0.50">
  10: <input type="hidden" name="handling" value="2.00 ">
  11: <input type="hidden" name="currency_code" value="USD">
  12: <input type="hidden" name="return" value="http://www.yoursite.com/thankyou.htm">
  13: <input type="hidden" name="undefined_quantity" value="1">
  14: <input type="image" src="http://images.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
  15: </form>

Fortunately for me the non-profit that was asking about this has now got their in-house IT guy to make the changes, it’s somewhat time consuming and if you only have 5 products or so, you can probably almost generate new add to cart buttons just as fast, which is what I recommended.

 

Creating an Add to Cart button – PayPal

Google+

Comments

comments