Skip Navigation LinksPayCircuit Home > Google Checkout Cookbook > Requiring Product Attribute Selections
Bookmark and Share

Implementing Required Product Attribute Selections

This sample shows one way (certainly not the only way) of requiring certain product attribute entries/selections for an item added to your Google Shopping Cart. In the sample below, in order to purchase a PayCircuit Coffee Mug Set priced at $19.95, a customer must choose 2 coffee blends.

In some ways, this is a much simplified version of a previous sample on Required Items in that a product itself must be "complete" when added to the cart (in order to purchase Item A, you must include certain Item A "attributes" that make it up). The previous sample implemented different/unique item/product relationships (in order to purchase Item A, you must also purchase Item B).

Note that this expands on the same sample code provided in this web site. As such it may contain other functions/features not necessarily relevant to this topic. This page likewise clears the cart contents each time it is requested and/or refreshed.

PayCircuit T-shirt
Price: $29.99
Color: Black
Brand: Paycircuit
Description The best shirt ever
PayCircuit Coffee Mug Set
Price: $19.95

Source/Reference

JavaScript

This should be in <head> of your HTML file, or you can create a .js file and reference it for easier management.

This code:

HTML

This sample should be within your <body>. Note that this makes use of the Google Checkout Shopping Cart (v. 2_2).

Copy the code below and modify the following for this to work:

  1. Provide your own Merchant ID (replace the mid=000000000000000 with your own merchant ID)
  2. post-cart-to-sandbox="true" is for Sandbox testing with your Sandbox Merchant ID
  3. post-cart-to-sandbox="false" for production/live use with your Production Merchant ID

Usage Tips:

  1. product-sku annotation is required
  2. Ensure that all your items have a globally unique product-sku within your listing/database
© 2012 PayCircuit. All Rights Reserved.