| Note: This is the latest documentation. The previous version of this page is also available. |
To use JavaScript controls, add each control as an attribute of the <script> tag that retrieves the Google Checkout shopping cart JavaScript file on your page. The HTML snippet below shows the basic <script> tag that you would use to include the JavaScript with the addition of several JavaScript customizations:
<script id="googlecart-script" type="text/javascript"
src="http://checkout.google.com/seller/gsc/v2/cart.js?mid=MERCHANT_ID"
currency="USD"
highlight-time="5000"
highlight-color="#FF7878"
cart-opening-time="500"
hide-cart-when-empty="true"
close-cart-when-click-away="false"
post-cart-to-sandbox="true">
</script>
This example uses seven JavaScript customizations:
To see the effect of these JavaScript customizations, add the item below to the shopping cart. Note that since the value of the hide-cart-when-empty setting is true, you must add an item to the cart before the cart will display on the page.
![]() |
Google T-Shirt Price: $12.99 Shipping: $4.99 Add to Cart |
The following controls let you modify various aspects of the shopping cart's visible behavior and appearance. Visible behavior includes cart properties that the user can see, such as the amount of time that the cart takes to expand and collapse.
| highlight-time: | This parameter specifies the length of time, in milliseconds, that a product will be highlighted after being added to the shopping cart. Default value: 2000 milliseconds |
| highlight-color: | This parameter specifies the color that the shopping cart will use to highlight a product that has just been added to the shopping cart. The parameter value is specified using hexadecimal color notation – #FF0000, #000, etc. Default value: #FFC |
| cart-opening-time: | This parameter specifies the length of time, in milliseconds, that the shopping cart will take to open and close. Default value: 200 milliseconds |
| scroll-time: | This parameter does something about scroll times. Default value: 200 milliseconds |
| maximum-short-description-size: | This parameter specifies the maximum number of characters to show in properties on the first line of the item details area in the list. Default value: 15 characters |
| maximum-long-description-size: | This parameter specifies the maximum number of characters to show in properties on subsequent lines of the item details area in the list. Default value: 60 characters |
| open-cart-on-add: | This parameter specifies whether the shopping cart widget will automatically open, or expand, when the user adds an item to the cart. The only valid values, which are case-sensitive, are "true" and "false". Default value: true |
| hide-cart-when-empty: | This parameter indicates whether the shopping cart widget will be invisible when empty. To hide the shopping cart widget if it is empty, set this parameter to true. The only valid values, which are case-sensitive, are "true" and "false". Default value: false |
| fade-out-time: | This parameter specifies the length of time, in milliseconds, that the shopping cart will take to fade to invisible if the hideCartWhenEmpty parameter is set to true and the shopping cart is empty. Default value: 500 milliseconds |
| close-cart-when-click-away: | This parameter indicates whether the shopping cart widget will automatically close, or collapse, when the user clicks on the page outside of the widget. The only valid values, which are case-sensitive, are "true" and "false". Default value: true |
The following controls let you customize other aspects of cart behavior that are not immediately visible to the user. For example, you can specify that the widget should use the current page URL as the product URL for any products added to the cart from that page.
| aid: | This parameter specifies the Analytics tracking code for your site if you are enabling Google Analytics tracking for your shopping cart orders. Default value: null |
| currency: | This parameter specifies the currency that Google will use for the product prices, shipping costs and taxes for your shopping cart orders. Valid values are USD and GBP. Default value: USD |
| vat-included: | This parameter indicates that a percentage of the prices of the items in the cart is VAT. When the customer proceeds to Google Checkout to complete the order, Checkout will reduce the prices of the items appropriately so that when Checkout adds VAT, the order total will match the subtotal displayed in the shopping cart. Default value: 0 |
| use-default-product-url: | This parameter indicates whether the shopping cart widget should use the current page URL as the product-url for products added to the cart from the current page. This parameter is only used if you have not specified a product-url for the product. See the Annotating Pages with Product and Shipping Information for more information about setting a product-url for a product. The only valid values, which are case-sensitive, are "true" and "false". Default value: false |
| post-cart-to-sandbox: | This parameter indicates whether the shopping cart will be sent to the Checkout sandbox (development) or production URL. The default cart behavior is to send shopping cart information to the Checkout production URL. The only valid values, which are case-sensitive, are "true" and "false". Default value: false |
| form-post-target-override: | This parameter specifies the URL to which the shopping cart will be sent. If you do not set a value for this parameter, then the post-cart-to-sandbox parameter determines the URL to which shopping carts will be submitted. Default value: null |
| free-shipping-order-size: | This parameter specifies a minimum order amount for an order to be eligible for free shipping. The default value (NaN) indicates that Google Checkout only determines that you offer free shipping if you explicitly set this parameter to a number. If the order subtotal equals or exceeds the free-shipping-order-size value, then the order will be eligible for free shipping. Default value: NaN |
| free-shipping-method-name: | This parameter specifies the name you want to display for your free shipping option, if you offer free shipping. Default value: Free Shipping |
| product-shipping-method-name: | This parameter specifies the name you want to display for your standard shipping option. Default value: Standard Shipping |
| « Previous (Controlling the Shopping Cart Widget's Appearance) |
Next » (Handling Orders and Getting Paid) |