Google Groups Home
Help | Sign in
Recent pages and files
Getting started with the Google Checkout shopping cart    

Google Checkout shopping cart - Getting Started

The Google Checkout shopping cart is a new Google Checkout feature that allows you to add a shopping cart to your website quickly and easily.
 
See the demo here: http://checkout.google.com/seller/gsc/beta/demo

This Getting Started document is intended to give you a quick outline of what is required to get up and running with the cart. For more information, please see the API Documentation as well as the Customizing the Cart Widget and the Using Shipping documents.

Step 1) Merchant account setup
Before you can use the cart, you'll need to ensure that your merchant account is set up to accept unsigned xml cart posts. To do this, follow the instructions on this page.

Step 2) Include the Google Checkout shopping cart Javascript


Adding the cart to your web store is easy. All you'll need to do is copy and paste a small Javascript snippet on every page on your site that you plan to use the cart.

Place this snippet of code as the last child of the <body> tag (i.e. directly above the </body> tag) of your HTML page. 
<script id="googlecart-script" type="text/javascript"
 src="http://checkout.google.com/seller/gsc/beta/cart-v1.js?mid=MERCHANT_ID&currency=CURRENCY_CODE">
</script> 

Make sure to replace MERCHANT_ID with your actual merchant ID and currency with either "USD" (if you're in the US) or "GBP" (if you're in the UK).

Step 3) Annotate your pages with Google Checkout shopping cart keywords

Next, you'll need to annotate your website so that the shopping cart can understand what products are on each page and find information related to these products. The best way to show you what we mean is by example. Let's say one of your web pages is selling a baseball bat. Your annotated HTML may look something like this:

<div class="product">
   <img class="product-image" src="baseball_bat.jpg"/>
   <span class="product-title">Baseball Bat</span>
   Price: <span class="product-price">$9.99</span>
   Shipping: <span class="product-shipping">$4.99</span>
   <span class="googlecart-add">Add to Cart</span>
</div>

Pay particular attention to the bold portions of the code above. This portion of the code tells the cart where to look to find the product image, title, and price. Don't forget to surround product-image, product-title, and product-price within an element which contains class="product", or the cart won't know where to look. 
 
Also notice the class="googlecart-add" on the <span> tag. This tells the cart which element should be the clickable element to add the item to the cart. If you'd like to use the "Add to cart" button image from Google, simply replace the last line with: 

<span class="googlecart-add-button"></span>

Please note you are not limited to <div> or <span> tags. You can use any html tag, including <input> tags. Also note that you can easily include several products on a single web page. Here is an example that uses a <table> tag that contains multiple products:

<table>
  <tr class="product">
    <td><img class="product-image" src="widget1.jpg"></td>
    <td class="product-title">Great Widget #1</td>
    <td class="product-price">$33.00</td>
    <td>
        Shipping: <span class="product-shipping">$3.99</span>
    </td>
    <td><a class="googlecart-add">Add to Cart</a></td>
  </tr>
  <tr class="product">
    <td><img class="product-image" src="widget2.jpg"></td>
    <td class="product-title">Great Widget #2</td>
    <td class="product-price">$14.00</td>
    <td>
        Shipping: <span class="product-shipping">$4.99</span>
    </td>
    <td><a class="googlecart-add">Add to Cart</a></td>
  </tr>
</table>
Custom attributes.
 
Do you have additional product attributes that you'd like to define for each product? For example, do you have various sizes or colors for the products you sell? For each piece of information you want to appear in the shopping cart, simply add the following: class="product-attr-xxx" where xxx is a short (one or two words, no spaces) description of the purpose of the tag. For example, to allow the customer to select the size of your product add a <select> tag annotated by product-attr-size:

<div class="product">
  ...
  <select class="product-attr-size">
     <option value="large">large</option>
     <option value="small">small</option>
  </select>
  ...
</div>
You can use all <input> tags, including hidden tags and <textarea> tags in a similar fashion.
For more information on available annotations and how the annotation value is computed for different tags,
see the section called "basic markup" in the API documentation.

That's it... You're Done!

You have successfully added the Google Checkout shopping cart to your store. Of course, Google Checkout would greatly appreciate your early feedback. Please contact us by posting on the cart group page at http://groups.google.com/group/google-checkout-shopping-cart/topics with comments/concerns and feature requests. And if you're interested in advanced functionality, see the related links listed below.
 
 
Enjoy!

The Google Checkout Team
http://checkout.google.com

 

Version: 
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google