Let’s say you are going to be selling one (or just a few) product(s) on your site. You may not want/need to store your products in a weblog because it seems like overkill for just a few products. Using the power of the add_to_cart_form, you can add items to your cart without having that product in a weblog.
{exp:cartthrob:add_to_cart_form
return="cart/view_cart"
on_the_fly="y"
price="9.95"
title="Our Site T-Shirt"
shipping="5"
weight="2"
}
Cost: $9.95<br />
Shipping Cost: $5<br />
Shipping Weight: 2 lbs<br />
Quantity: <input type="text" name="quantity" value="1" /><br /><br />
<input type="submit" value="Add to Cart" />
{/exp:cartthrob:add_to_cart_form}
If you are selling multiple sizes/colors of T-Shirt, you can use the item_options variable within the add_to_cart_form tag. In this scenario, you most likely will need to set the extension setting called “Allow items to appear more than once in cart” to yes. This can be found in Product Settings > Product Options.
{exp:cartthrob:add_to_cart_form
return="cart/view_cart"
on_the_fly="y"
price="9.95"
title="Our Site T-Shirt"
shipping="5"
weight="2"
}
Cost: $9.95<br />
Shipping Cost: $5<br />
Shipping Weight: 2 lbs<br /><br />
Quantity: <input type="text" name="quantity" value="1" /><br /><br />
Color: {item_options:select:color values="red:Red|blue:Blue|green:Green"}<br />
<br />
Size:
{item_options:select:size}
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
{/item_options:select:size}
<br />
<input type="submit" value="Add to Cart" />
{/exp:cartthrob:add_to_cart_form}
