Creating an Add to Cart button


How to turn your PayPal Website Payments Button into an "Add to Cart" button for use with PayPal's Shopping Cart.

Note: Manipulating the PayPal Website Payments button takes some familiarity with HTML. If you are not comfortable editing your HTML code by hand, please create new buttons via the Shopping Cart Button Factory.

Before you begin:

Unlike a PayPal Website Payments button, where all fields are optional, the PayPal Shopping Cart requires the item_name and amount fields. If you did not use either of these fields when you created your PayPal Website Payments button, please create new buttons via the PayPal Button Factory.

The current HTML code for your PayPal Website Payments button should look similar to this:

<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="payments@yoursite.com">
<input type="hidden" name="item_name" value="Baseball Hat">
<input type="hidden" name="item_number" value="123">
<input type="hidden" name="amount" value="5.95">
<input type="hidden" name="shipping" value="1.00">
<input type="hidden" name="shipping2" value="0.50">
<input type="hidden" name="handling" value="2.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.yoursite.com/thankyou.htm">
<input type="hidden" name="undefined_quantity" value="1">
<input type="image" src="http://www.paypalobjects.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!">
</form>


To transform the PayPal Website Payments code above into an 'Add to Cart' button:

1. Copy your Buy Now Buttons code from your website into a text editor.

2. Add target="paypal" to the <form> tag:

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



3. Find this line in your code:

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



4. Replace "_xclick" with "_cart":

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



5. Add the following line somewhere between the <form> tags:

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



6. Find the "input type=image" line in your code:

<input type="image" src="http://www.paypalobjects.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!">



7. Replace the "input type=image" line with:

<input type="image" src="http://www.paypalobjects.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!">



8. Your code should now look similar to the code below:

<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="payments@yoursite.com">
<input type="hidden" name="item_name" value="Baseball Hat">
<input type="hidden" name="item_number" value="123">
<input type="hidden" name="amount" value="5.95">
<input type="hidden" name="shipping" value="1.00">
<input type="hidden" name="shipping2" value="0.50">
<input type="hidden" name="handling" value="2.00 ">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.yoursite.com/thankyou.htm">
<input type="hidden" name="undefined_quantity" value="1">
<input type="image" src="http://www.paypalobjects.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!">
</form>



9. Remove the original PayPal Website Payments HTML code and paste the code you just created into your website's HTML code. A PayPal 'Add To Cart' button will appear on your website instead of your original Single Item Purchase button.

10. To complete your implementation of the PayPal Shopping Cart, you will still need to add a 'View Cart' button to your website. To create a 'View Cart' button, create a regular 'Add to Cart' button on the PayPal Shopping Cart Button Factory. On the second page of the PayPal Shopping Cart Button Factory, you will find the code for your 'View Cart' button.