WordPress.org

Plugin Directory

Rexivue Restaurant Product Customization Fields for WooCommerce

Rexivue Restaurant Product Customization Fields for WooCommerce

Description

Add extra fields that customers fill in or choose on the product page. Each field can add a price. Selections are shown in the cart, mini-cart and checkout, and saved on the order (admin screen, emails, My Account).

Field types

  • Text: single line. Its price is charged only when the customer enters something.
  • Textarea: collapsible multi-line text.
  • Message: collapsible short text plus a message textarea.
  • Radio cards: one choice. A label such as “Large – 500 ml” shows “500 ml” as a description line.
  • Dropdown: one choice.
  • Checkboxes: any number of choices. Each ticked option adds its price.
  • Image swatches: one choice, shown as cards with one preview image per field.

Any field can be marked required. Radio cards, dropdowns and image swatches always have a choice (the first option is pre-selected).

Variation radio buttons

Variation attributes such as size or colour are shown as buttons instead of dropdowns. WooCommerce’s own dropdown stays in the page, hidden, so WooCommerce still does all the matching of variations, price, stock, image and availability. Combinations that WooCommerce disables or removes are disabled or hidden on the buttons too. You can switch this off store-wide.

Security

Prices are never taken from the browser. The page only sends which option was chosen (or the text typed). Every price is read from the product’s configuration on the server and applied to the cart item there. Values are validated against the configuration, and anything else is rejected with a message.

Configuration

Per product: edit a product and use the Product add-ons box.

  • Label: shown to the customer and used as the name in the cart and order.
  • Type: one of the field types above.
  • Options / price:
    • For radio cards, dropdown, checkboxes and image swatches, enter options separated by commas, each as Label|price, for example Small|0, Large – 500 ml|20. Labels cannot contain commas or |. Use a dot for decimals.
    • For text, textarea and message, enter a single price, for example 5. The old Label|5 form is also accepted.
  • Required: the customer must fill in the field (text types) or tick at least one box (checkboxes).
  • Image URL / note: for image swatches, a preview image URL (http or https). For other types it is a private note that customers don’t see.
  • Use to reorder fields and Remove to delete one.

Prices are per item and are added to the product (or variation) price. Negative prices are allowed as discounts, but an item’s price never goes below 0.

Store-wide: WooCommerce Settings Products Product add-ons.

  • Variation radio buttons: on (default) or off.
  • Add-ons heading: text above the fields (default “Customize your product”).
  • Uninstall: whether deleting the plugin also deletes every product’s add-on configuration (default: no).

Usage notes

  • Products with add-ons show “Select options” in shop listings and link to the product page, so customers can choose their options.
  • When a product’s add-on configuration changes, open carts are checked again. Prices update to the current configuration. A line whose chosen option no longer exists is removed with a notice.
  • “Order again” restores the add-ons from the original order, at current prices.
  • Identical configurations of the same product merge into one cart line; different configurations are separate lines.

Compatibility

  • WordPress 6.5 or newer (tested up to 7.1.2).
  • WooCommerce 8.2 or newer (tested with 11.1.2).
  • PHP 7.4 to 8.4.
  • High-Performance Order Storage (HPOS): compatible and declared. Orders are only accessed through WooCommerce CRUD methods.
  • Cart and Checkout blocks: compatible and declared. Add-ons are shown in the block cart and checkout, and are validated for Store API requests.
  • Classic themes and the classic cart/checkout shortcodes.
  • Product types: simple and variable. Add-ons are configured on the parent product and apply to all its variations.

Hooks

Actions:

  • rexivue_rpcf_loaded( Plugin $plugin ): all components are registered. Use $plugin->get( 'cart' ) and similar to reach one.

Filters:

  • rexivue_rpcf_product_fields( array $fields, WC_Product $product ): the normalised add-on fields of a product.
  • rexivue_rpcf_validated_selection( array $result, array $fields, WC_Product $product ): the trusted selection (items, total) before it is stored in the cart.
  • rexivue_rpcf_max_length( int $max, array $field, WC_Product $product ): maximum characters for text (default 255) and textarea/message (default 2000) values.
  • rexivue_rpcf_cart_item_price( float $price, float $base, float $total, WC_Product $product ): final unit price of a cart item with add-ons.
  • rexivue_rpcf_use_variation_radios( bool $enabled, WC_Product $product, string $attribute ): show one attribute as radio buttons or not.

WooCommerce hooks used: woocommerce_before_add_to_cart_button, woocommerce_add_to_cart_validation, woocommerce_add_cart_item_data, woocommerce_add_cart_item, woocommerce_pre_remove_cart_item_from_session, woocommerce_get_cart_item_from_session, woocommerce_get_item_data, woocommerce_check_cart_items, woocommerce_add_order_again_cart_item, woocommerce_order_again_cart_item_data, woocommerce_checkout_create_order_line_item, woocommerce_order_item_display_meta_key, woocommerce_dropdown_variation_attribute_options_html, woocommerce_admin_process_product_object, woocommerce_product_add_to_cart_url, woocommerce_product_add_to_cart_text, woocommerce_product_supports, woocommerce_get_sections_products, woocommerce_get_settings_products.

AJAX actions, REST routes, shortcodes: none. The plugin adds no endpoints of its own. (2.1 shipped a script that called an sp_update_price AJAX action that never existed; it has been removed.)

Data

  • Product meta _rexivue_rpcf_addons (copied from the earlier plugin’s _sp_addons, which is left in place): array( 'version' => 3, 'fields' => array( … ) ). version is the data format (1.0 writes format 3; earlier releases wrote no number).
  • Cart item data rexivue_rpcf: array( 'version' => 3 (data format), 'items' => array( … ), 'total' => float ).
  • Order line item meta: one visible entry per add-on (key = field label, value = plain text such as Large – 500 ml (+₹20.00)), Add-ons total, and hidden _rexivue_rpcf_order_addons (structured copy used by “Order again”).
  • Options: rexivue_rpcf_db_version, rexivue_rpcf_variation_radios, rexivue_rpcf_heading, rexivue_rpcf_delete_data_on_uninstall.

Migration

From the earlier “SP Flexible Product Addons” plugin (2.1 and before). Install this plugin, activate it, then deactivate and delete the old one.

  • Product configuration is kept. In the background (Action Scheduler, 50 products per batch), each product’s _sp_addons configuration is copied to _rexivue_rpcf_addons, and each field gets a permanent ID and text fields get an explicit price. The old _sp_addons value is not changed or deleted. Until a product has been processed, the old value is read and converted on the fly, so nothing depends on the batch finishing.
  • Carts that were open during the upgrade are converted and re-priced from the configuration.
  • Product pages cached before the upgrade (with 2.1 field names) still work. Their submitted prices are ignored.
  • Orders placed with 2.x are not changed. Their add-on meta may contain HTML price markup, which still displays correctly.
  • The two variation-radio files that shipped inside the old plugin folder (wc-variant-radio-buttons.php, wc-variant-radios-fixed.php) are replaced by the built-in variation radios.

Uninstall

Deleting the plugin always removes its settings (rexivue_rpcf_* options). Product add-on configuration (_rexivue_rpcf_addons) is removed only if “Delete every product’s add-on configuration” was ticked in the settings. Orders, order item meta, products, customers and users are never touched.

Deactivating the plugin removes nothing.

Shortcodes

  1. Backend Settings
  2. Product Backend
  3. Product Frontend
  4. Readme

Screenshots

Installation

  1. Make sure WooCommerce 8.2 or newer is active.
  2. Upload the rexivue-restaurant-product-customization-fields folder to /wp-content/plugins/, or use Plugins Add New Upload Plugin.
  3. Activate the plugin.

Coming from the earlier “SP Flexible Product Addons” plugin (folder sp-flexible-product-addons, up to version 2.1): this is a separate plugin with a new name. Install and activate it, then deactivate and delete the old one. Do not keep both active. Existing add-on configuration is picked up automatically. See “Migration” below.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Rexivue Restaurant Product Customization Fields for WooCommerce” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0

First release under this name. A rewrite of the earlier “SP Flexible Product Addons” plugin (2.1), which it replaces and imports product data from.
* Security: add-on prices, labels and options are now validated and priced on the server. 2.1 trusted prices posted by the browser, so a customer could set any price, including negative ones.
* Fix: add-on prices were added again every time cart totals were recalculated, which overcharged block (Store API) checkout orders.
* Fix: checkbox and image swatch add-ons never reached the cart in 2.1, because of broken HTML (escaped quotes).
* Fix: required fields are now enforced (server-side, with an accessible client-side check).
* New: shop “Add to cart” buttons link to the product page for products with add-ons; AJAX, Store API and “Order again” adds are validated.
* New: open carts are re-validated against the current configuration.
* New: “Order again” restores add-ons.
* New: add-ons total preview on the product page.
* New: settings section (variation radios on/off, heading, uninstall behaviour).
* Changed: variation radio buttons are placed next to WooCommerce’s own dropdown and driven by WooCommerce’s variation events. Unavailable combinations are mirrored, the radios are keyboard accessible, and the “Clear” link keeps working.
* Changed: order meta is saved as plain text through the WooCommerce CRUD API. The deprecated woocommerce_add_order_item_meta hook is no longer used.
* Changed: HPOS and Cart/Checkout blocks compatibility declared.
* Changed: new architecture (namespaced classes, views, separate CSS/JS files loaded only where needed), translation-ready, WordPress Coding Standards.
* Removed: development backups (.php_, .php_old), the two standalone variation-radio plugin files, and the unused assets/ files.