Our GooglebaseXML component allows you to submit what Google terms product variants, using Virtuemart child products. This article describes this process, it assumes that you are using Virtuemart 2.
Before attempting this it is a very good idea to first read Google's product feed specification (the section on product variants is about half-way down) to check whether your products can meet the requirements. If not, then you will need to submit the parent product instead. If that is your choice then there is nothing special that you need to do, by default the feed component will submit the parent product data.
There is a summary of Google's attribute requirements here. If you want to submit product variants they must differ according to at least one of the following attributes: gender, age-group, color, size, material and pattern, and the attribute information must be supplied. Note that you do not need to be submitting product variants in order to include attributes. For apparel products in the United States Google requires that you include gender and age group even if you are not submitting variants.
If you want to submit attribute information you need to enable this in the GooglebaseXML options (view here).Go to the product variant options tab and set Show Product Attributes to 'yes'.
You will need to actually supply the attribute information. You can supply attribute information by creating custom fields for your products. The process is:
The process needs to be done in that order because until some custom fields are defined they will not be available as options in the GooglebaseXML configuration.
If your store mostly sells products that have the same values for the attributes, for example if you mainly sell clothes for adult women, you can save yourself a lot of time by setting default values, in this case 'Adult' and 'Female' for the age group and gender attributes. The feed will use these values unless you override them using a custom field value, so you may only need to supply specific attribute information for a small number of products that are the exception.
To submit child products as product variants you need to enable the 'Show Product Variants' option in the GooglebaseXML options. If this option is selected, for products that have children, the child products will be displayed instead of the parent product, which will not be displayed. If this option is not selected child products will be excluded from the feed, only the parent products will be displayed. Simple products that do not have children or parents are unaffected by this option.
Virtuemart offers more than one way to handle parent-child relationships. If you do not require separate stock-handling for your child products the simplest way to set these up is to use a 'generic child variant' custom field. The process is:
Now when the customer views the product page they should see a selection box allowing them to pick a size corresponding to the child products you have defined.
The generic child variant field has a behaviour that some store owners do not like: when the customer picks an option they will be directed to a new page. It might be nice if the customer were to stay on the same page, and the chosen option information were loaded using AJAX. If this is what you want you will need to use the stockable variants plugin, which also has the advantage that it allows you to use stock control with the child products: only those that are in stock will be available to customers. Usage of the stockable variants plugin is described in detail here.
The feed will normally display the correct price for your product variants without requiring any special options. It is designed to be compatible with the stockable variants plugin.
For some child products you may have a situation where the price varies between the children. For example there may be small, medium and large options available and you charge more for the medium and large sizes. If you are using generic child variants then you can do this by specifying different cost prices for the child options (view example).
If you are using the stockable variants plugin it is possible to modify the pricing for child products either by specifying different cost prices for the children, or by specifying additional charges for the options on the custom fields tab (view example). In the latter case these are charges that will be added to the cost price of the parent product. If you are doing things this way you will need to enable the 'Calculate Plugin Prices' option in the GooglebaseXML product variant options to ensure that the charges will be calculated correctly in your product feed. If you are not doing things this way (or your child prices do not vary from the parent) it will be more efficient to turn this option off, to avoid unnecessary calculation.