Skip to content

Conversation

@arifulhoque7
Copy link
Contributor

@arifulhoque7 arifulhoque7 commented Nov 6, 2025

Title (Close issue )

Remove Currency Symbol Auto-Population from AI Form Builder

Description

This PR removes automatic currency symbol handling from the AI form builder's 3rd stage (sanitization) and success stage (preview). Currency symbols were being auto-populated by the system, but this should only occur if explicitly specified by users.

Changes

  1. Backend (RestController.php): Removed automatic currency_symbol assignment for pricing and cart_total fields
  2. Frontend (FormSuccessStage.vue):
    • Removed all currency symbol display fallbacks
    • Fixed pricing dropdown styling with proper dropdown icon and design
  3. Documentation: Updated AI prompts to exclude currency symbol generation

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • UI/UX improvement
  • New feature
  • Breaking change

Testing

  • Verified pricing fields display without currency symbols
  • Verified dropdown arrow icon displays correctly
  • Verified form submission functionality

Checklist

  • My code follows the project style guidelines
  • No new warnings generated
  • Related documentation has been updated

Summary by CodeRabbit

  • UI Improvements

    • Pricing display across all form fields (radio, checkbox, dropdown, multiselect) now shows prices without currency symbol prefixes
    • Pricing dropdown styling enhanced with decorative caret icon
    • Cart total displays as numeric value without currency symbol
  • Documentation

    • Updated guidance clarifying pricing fields are restricted to post forms only

@arifulhoque7 arifulhoque7 requested a review from Copilot November 6, 2025 07:32
@arifulhoque7 arifulhoque7 self-assigned this Nov 6, 2025
@arifulhoque7 arifulhoque7 added needs: dev review This PR needs review by a developer needs: testing labels Nov 6, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Walkthrough

This PR removes currency symbol display from pricing-related fields across Vue components and REST controllers, while updating AI prompt documentation to restrict pricing fields to post forms only. Changes include removing currency_symbol defaults, simplifying pricing output to show only numeric values, adding SVG caret decorations to dropdown selects, and clarifying that pricing fields are not permitted in registration forms.

Changes

Cohort / File(s) Summary
Vue component pricing display updates
assets/js/components/FormSuccessStage.vue
Removed currency_symbol prefixes from all pricing field renders (radio, checkbox, dropdown, multiselect, cart total). Replaced simple dropdown container with wrapper div and added SVG caret element for dropdown styling. Updated option labels to display as {{ option.label }} - {{ price or 0 }} format.
REST controller defaults
includes/AI/RestController.php
Removed two defaulting blocks that set currency_symbol to '$' and 'USD' respectively, eliminating automatic currency symbol population for pricing fields.
AI prompt documentation updates
includes/AI/wpuf-ai-minimal-prompt-registration.md
Removed Pricing Fields (Pro) section entirely. Added caution that pricing fields are not allowed in registration forms and are reserved for post forms only. Updated response rules to include explicit prohibition on pricing fields in registration forms.
AI prompt base guidance
includes/AI/wpuf-ai-minimal-prompt.md
Removed currency symbol reference section. Updated pricing field examples to exclude currency_symbol while preserving options and prices. Modified cart_total examples to use "Total" or "Total Amount" labels without currency symbols.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • FormSuccessStage.vue: Verify that removing currency_symbol from all pricing field types (radio, checkbox, dropdown, multiselect, cart total) is applied consistently and doesn't break dependent styling or calculations
  • SVG caret addition: Confirm the new dropdown caret SVG is properly rendered and doesn't introduce accessibility issues
  • Prompt documentation: Ensure the pricing field restriction rules in both registration and minimal prompt files are coherent and won't cause unexpected AI behavior or errors when pricing fields are encountered

Possibly related PRs

Suggested reviewers

  • sapayth

Poem

🐰 No symbols clutter the price display,
Just numbers clean as morning hay,
With carets dancing, dropdowns shine,
Registration forms draw the line—
Pricing's for posts, not forms today! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: removing currency symbols from AI form builder pricing fields, which is the core objective across all modified files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61f733e and bbade4d.

⛔ Files ignored due to path filters (1)
  • assets/js/ai-form-builder.min.js is excluded by !**/*.min.js
📒 Files selected for processing (4)
  • assets/js/components/FormSuccessStage.vue (3 hunks)
  • includes/AI/RestController.php (0 hunks)
  • includes/AI/wpuf-ai-minimal-prompt-registration.md (2 hunks)
  • includes/AI/wpuf-ai-minimal-prompt.md (5 hunks)
💤 Files with no reviewable changes (1)
  • includes/AI/RestController.php
🔇 Additional comments (11)
includes/AI/wpuf-ai-minimal-prompt-registration.md (2)

404-414: LGTM! Clear guidance on pricing field restrictions.

The new section effectively communicates that pricing fields are not supported in registration forms, with a comprehensive list of prohibited field types and helpful alternative guidance for users who request payment functionality.


536-536: LGTM! Rule consistently reinforces pricing field restrictions.

The addition of rule 6 provides a concise summary of the pricing field restrictions detailed earlier in the document, making it easy for the AI to reference during form generation.

includes/AI/wpuf-ai-minimal-prompt.md (4)

485-485: Verify guidance for users who need currency symbols.

The removal of currency_symbol from the field properties is consistent with the PR objectives. However, consider whether the documentation should mention that users can include currency symbols as part of the option labels themselves if needed (e.g., "Basic Package - $10" instead of "Basic Package" with separate currency_symbol).

Would you like me to search the documentation to see if there's alternative guidance for displaying currencies?


486-500: LGTM! Example correctly shows pricing without currency_symbol.

The pricing_radio example is updated to remove currency_symbol, showing only options and prices. This aligns with the updated guidance on line 485.


504-508: LGTM! Cart total example simplified appropriately.

The cart_total example now shows a cleaner structure without currency_symbol. The generic label "Total Amount" works well for international forms where currency might vary.


512-562: LGTM! All pricing examples consistently updated.

All the pricing examples throughout this section have been updated to remove currency_symbol, demonstrating the new approach across different scenarios (user-specified prices, generated demo prices, checkboxes). The examples are comprehensive and consistent.

assets/js/components/FormSuccessStage.vue (5)

276-290: LGTM! Pricing radio display simplified correctly.

The removal of currency_symbol from the pricing display (line 285) aligns with the PR objectives. The fallback to '0' provides a reasonable default for the preview.


292-306: LGTM! Pricing checkbox display matches pricing radio approach.

The currency_symbol removal for pricing checkboxes (line 301) is consistent with the pricing radio changes, maintaining uniformity across pricing field types.


309-325: LGTM! Pricing dropdown improved with better styling.

The changes to the pricing dropdown are well-executed:

  1. Currency symbol removed from option labels (line 317)
  2. Added relative positioning container for proper caret placement (line 309)
  3. Introduced SVG caret icon for consistent dropdown styling (lines 322-324)

The caret uses absolute positioning within the relative container and is properly styled with pointer-events-none to prevent interaction issues.


327-337: LGTM! Pricing multiselect display consistent with other pricing fields.

The currency_symbol removal for pricing multiselect (line 332) maintains consistency across all pricing field types in the component.


339-345: LGTM! Cart total preview displays clean numeric value.

The hardcoded "0.00" display (line 343) without currency_symbol is appropriate for a preview component. The actual calculated total would be displayed here in a live form, and removing the automatic currency symbol gives users more flexibility in how they present pricing.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the currency_symbol field from pricing-related form fields across the WPUF AI form builder. The changes centralize currency management to use system-level settings rather than per-field configurations.

  • Removed currency_symbol from AI prompt documentation for pricing fields
  • Removed currency_symbol default value assignments in backend field sanitization
  • Updated frontend Vue component to not display currency symbols alongside prices

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
includes/AI/wpuf-ai-minimal-prompt.md Removed currency symbol documentation and examples from pricing field prompts
includes/AI/wpuf-ai-minimal-prompt-registration.md Removed all pricing field documentation from registration forms and added warnings that pricing fields are not allowed
includes/AI/RestController.php Removed automatic currency_symbol default assignment in sanitize_form_fields method for pricing and cart_total fields
assets/js/components/FormSuccessStage.vue Removed currency symbol display from pricing field templates and improved dropdown UI with added select caret icon

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
if (!isset($field['enable_quantity'])) {
$field['enable_quantity'] = 'no';
}
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of currency_symbol default assignment in RestController.php appears inconsistent with the field templates in Field_Templates.php (lines 1434, 1467, 1497, 1529, 1561, 1582), which still define currency_symbol defaults. This creates a mismatch where template definitions include the property but the sanitization layer no longer sets it. Consider also removing currency_symbol from the field template definitions in includes/AI/Field_Templates.php or documenting why templates retain it while sanitization doesn't set it.

Suggested change
}
}
if (!isset($field['currency_symbol'])) {
$field['currency_symbol'] = '$';
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: dev review This PR needs review by a developer needs: testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant