By default, this tag loops through each of the product addons available. Can also be used to output a menu of addons.

shopp('product', 'addons', 'options')

@param string $object the object or object.tag combination, if object.tag is used, the tag parameter can be omitted
@param string $tag the tag, can be hyphenated or not. Prefix with 'get' as shorthand for the return=true option
@param mixed $options associative array, or url-style name=value pairs separated by ampersands (&). Each pair is passed to the theme api tag as an option.
@returns mixed, when looping will return true while in the addons loop, false when finished looping. When used to display a menu of addons, will return void and display the menu by default, return the menu markup when return option is used.

Alternative Forms

shopp('product.addons', 'options...');


By default, this tag loops through each of the product addons available.

When the mode option is used, a menu can be displayed of the product’s addons. Disabled addons will automatically be excluded, and out of stock addons will automatically be disabled. The price for each addon reflects an additional cost that will be added to the product.

Universal Options

All Theme API calls have these options.

  • return: when set to true, 1, or on, this option forces the tag to return the value instead of displaying/echoing the value to the page. Alternatively, prefix the tag parameter with get to get the same effect. All theme api tags that return a boolean value will return by default.
  • echo: when set to false, 0, or off, this option forces the tag to display the value to the page. This is the default for all non-boolean tags.
  • is: when set to true, 1, or on, this option will evaluate the return of the theme api call as a boolean true or false value. See how values are converted to boolean.


The following options are valid.

  • mode: Default is (not set). If not set, the theme api call will loop through each addon. When set to menu the tag will render drop-down selection menus for each of the add-on groups defined in the product editor. When set to single, the tag will render a single select menu with all the available addons for the product, and only one addon can be selected.

Menu Options

When the mode option is set, the following options can be used.

  • after_menu: No default value. Allows you to specify a string of characters or HTML markup to display after the the menu is displayed.
  • before_menu: No default value. Allows you to specify a string of characters or HTML markup to display before the label (if enabled) and the menu are displayed.
  • defaults: No default value. Allows you to specify a default option that is displayed as the initial selection for the menu.
  • label: Default is on. Displays a label with the name of the menu as entered in the product editor before the menu.
  • format: Default is %l (%p). Set the format of the options shown in drop-down menus. See Format Options below for available formatting tokens.
  • class: Empty by default, string is included in the class attribute of each select HTML tag when mode=menu is set. This should be simple class names separated by a spaces. This is not used in loop or single mode.
  • required: Default is unset. When set to any true value, an addon selection is required when the product is added to the shopping cart, and the required_error option will be displayed if the customer does not select an addon.
  • required_error: Default is You must select the options for this item before you can add it to your shopping cart.. Specifies the warning error when attempting to add a product to the cart without selecting all of the necessary variation options.
  • taxes: Default behavior depends on the inclusive tax setting and the tax flag on the addon priceline in the product editor. This setting can override the default inclusive tax behavior. When set to true, and the item is taxable, includes the tax in the price(s) shown. When set to false, excludes tax from the price(s) displayed.

Format Options

  • %p — shows the current variant price including available discounts.
  • %l — show the option label.
  • %s — show the stock amount of a product in inventory
  • %d — show the discount amount of an on sale variant.
  • %r — show the original price (the non-sale price) of the product variant.
  • %u — show the SKU for the product variant.


Loop through addons

if ( shopp('product','has-addons') ) {
    while( shopp('product', 'addons') ) {
        // do code for each addon

Display a menu of addons for each addon group

if ( shopp('product','has-addons') ) {
    $options = array(
        'mode' => 'menu', // addon group menu mode
        'defaults' => 'Select an Option', // displayed when group has no selection yet
        'before_menu' => '<img src="" />', // an image
        'after_menu' => '<div class="after-addon-menu"></div>', // included after each group
        'label' => 'off', // turn off menu label
        'required' => true, // require an addon selection
        'required_error' => 'You must select an addon to continue.', // override required warning

    shopp('product.addons', $options );

Display a single default menu

if ( shopp('product','has-addons') ) {
    shopp('product','addons', 'mode=single' );

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.