Overview
Versions prior to 1.0.0-beta used hardcoded PHP template files for the CEP and Certificates forms. Starting with 1.0.0-beta, both flows are driven by a JSON field schema stored either in the WooCommerce product’s_utb_form_config post meta or in the certificate record’s form_config_json column. The migration converts the legacy templates to this format.
Database migration
The plugin tracks its schema version in the WordPress optionutb_pb_db_version. On every plugins_loaded event, Plugin::init() compares this value against the required version (3.0.1):
3.0.1
Migrating from hardcoded PHP templates to JSON-driven flows
Identify the product IDs for each environment
The migration script references WooCommerce product IDs directly. These IDs differ between staging and production.Note the product IDs for the CEP product and the Certificates product in each environment.
Run the migration script
get_default_config() method and writes it as JSON to the _utb_form_config post meta on the corresponding product. After this step, FormConfigManager::get_config() will serve the JSON schema instead of falling back to the hardcoded default.Verify the JSON was saved
get_default_config().Post-migration testing checklist
Run this checklist on every environment after migration:Wizard steps and conditional fields
- All form sections render in the correct order.
- Conditional fields (e.g.,
utb_qtyhidden until a quantity-enabled certificate is selected) show and hide correctly when expected. - Required field markers (
*) appear on all required fields.
Pricing
- CEP: Selecting a program displays the correct price below the selector. Price disappears and reappears correctly on change (no CSS animation block).
- CEP: Entering a valid document number and names triggers the discount check. The discount banner renders with the correct percentage and final price.
- Certificates: Changing certificate, format, or level updates the price display in real time.
- Certificates: Price for a certificate without explicit level assignments resolves correctly for both Pregrado and Posgrado.
Server-side validation
- Submitting the CEP form with mismatched names and document returns the identity mismatch error.
- Submitting the Certificates form without accepting policies is blocked.
- Submitting with a certificate that does not match the applicant type (e.g., student certificate for an egresado role) is blocked.
Order metadata
- After checkout, inspect the order in WooCommerce → Orders → (order).
- All
_utb_cep_*or_utb_cert_*meta keys are visible with correct values. - The
_utb_cep_descuento_porcentajeand_utb_cep_rol_aplicadokeys are populated when a discount was applied. - The
_utb_cert_price_totalkey reflectsprice_unit × qty.
Webhooks
- Complete a test order and verify a row was created in
wp_utb_webhook_logs. - The webhook log entry shows status
success(orfailedwith retry count if the endpoint was unreachable).
Identifying product IDs across environments
Because WordPress auto-increments post IDs, the same product will have different IDs in staging and production. Use one of these approaches to keep the migration script environment-agnostic: By post title:product_id => flow_id pairs that shows every product already linked to a flow.
By post meta: