Free edition
The free edition applies no filters or actions of its own.
| What | Value |
|---|---|
| Product meta | _gmpaf_addons — up to three { label, type (text|checkbox), price } |
| POST field | gmpaf_addon[0..2] (yes for a ticked checkbox) |
| Cart item key | gmpaf_addons — the chosen { label, value, price } list |
| Order line meta | One row per choice, keyed by the option's label |
| CSS | .gmpaf-addons, .gmpaf-addon, .gmpaf-fee |
The full edition reads _gmpaf_addons (as flat-fee custom_text and one-option checkbox add-ons) for any product that has no _gmpa_addons of its own, and never writes or deletes the free row. The free edition's uninstall leaves _gmpaf_addons alone once gmpa_settings or gmpa_license exists.
Full edition — filters
| Filter | Arguments | What it changes |
|---|---|---|
gmpa_addons |
$addons, $product_id |
The final resolved field list for a product, after globals are merged |
gmpa_field_prefix |
$prefix, $product_id |
The prefix used to build each field's POST name (default {product_id}-) |
gmpa_global_query_args |
$query_args, $term_ids |
The query that finds global groups for a product |
gmpa_product_terms |
$term_ids, $product_id |
The categories a product is matched against for global groups |
gmpa_show_grand_total |
$show |
Whether the running-total panel shows |
gmpa_adjust_price |
$adjust, $cart_item |
Whether add-on prices are applied to a cart item at all |
gmpa_cart_item_data |
$entry, $addon, $product_id |
Each add-on entry as written to the cart item |
gmpa_order_line_item_meta |
$record, $entry, $item |
Each record as written to an order line |
gmpa_upload_dir |
$subdir |
The folder customer uploads go into |
gmpa_restriction_data |
$data, $addon |
The client-side validation rules for a field |
gmpa_option_price_label |
$label, $price, $price_type |
The price label beside each option |
gmpa_settings |
$settings |
The merged settings |
gmpa_modules |
$modules |
The module list |
// No add-on pricing for wholesale customers' cart lines.
add_filter( 'gmpa_adjust_price', function ( $adjust ) {
$roles = (array) wp_get_current_user()->roles;
return $adjust && ! in_array( 'wholesale_customer', $roles, true );
} );
// Show "+ €5" instead of the default price label.
add_filter( 'gmpa_option_price_label', function ( $label, $price, $type ) {
return 'percentage_based' === $type ? $label : '+ ' . wp_strip_all_tags( wc_price( $price ) );
}, 10, 3 );
Action
gmpa_booted — fires once the plugin's modules have booted, with the service container.
Full edition — storage
| Where | Key |
|---|---|
| Product meta | _gmpa_addons (the field list), _gmpa_exclude_global |
| Global group post type | gmpa_global_addon with _gmpa_addons, _gmpa_priority, _gmpa_all_products and product_cat terms |
| Options | gmpa_settings, gmpa_addons_generation (cache generation), gmpa_imported_groups, gmpa_license |
| Object cache group | gmpa_addons |
| Order line meta | One visible row per field, plus hidden _gmpa_ids and _gmpa_total |
| Uploads | uploads/gmpa_uploads/{customer hash}/ |
The field shape
Each stored field is normalised to these keys: id, name, title_format, description_enable, description, placeholder_enable, placeholder, type, display, position, required, restrictions, restrictions_type, adjust_price, price_type, price, min, max, default, options, limit_file_types, allowed_file_types. Each option: label, price, price_type, image, visibility.
Reads are normalised again, so a missing key or an unknown value is corrected rather than passed on.
POST keys
addon-{product_id}-{addon_id} — the same shape WooCommerce Product Add-Ons uses, so theme customisations keep working after a switch. Radio buttons post the option slug; dropdowns post slug-index.
Store API
Add-to-cart requests may carry addons_configuration, translated into the classic posted shape and validated the same way.
Full edition — CSS classes
| Class | Element |
|---|---|
gmpa-addons |
The wrapper above the add-to-cart button |
gmpa-addon, gmpa-addon--required |
One field |
gmpa-label, gmpa-name, gmpa-required, gmpa-price |
Title parts |
gmpa-select, gmpa-radio, gmpa-swatch, gmpa-option |
Choice fields |
gmpa-text, gmpa-textarea, gmpa-multiplier, gmpa-custom-price, gmpa-date, gmpa-file |
Input fields |
gmpa-totals, gmpa-subtotal |
The running total |
