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 in radio, checkbox, dropdown and multiselect fields now displays numeric prices without currency symbol prefixes
    • Pricing dropdown styling enhanced with a decorative caret for improved visuals
    • Cart total now displays as a numeric value without a currency symbol
  • Documentation

    • Guidance updated: pricing fields are not allowed in registration forms and are intended for post forms only; instructions adjusted accordingly

✏️ Tip: You can customize this high-level summary in your review settings.

@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

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR removes default currency_symbol usage and currency prefixes from pricing displays, adds a decorative SVG caret wrapper for dropdowns in the Vue template, and updates AI prompt docs to forbid pricing fields in registration prompts and remove pricing examples/defaults.

Changes

Cohort / File(s) Summary
Vue component — pricing display
assets/js/components/FormSuccessStage.vue
Removed currency_symbol prefixes across pricing renders (radio, checkbox, dropdown, multiselect, cart total). Wrapped dropdown in a container and added an SVG caret for styling; option labels now render as {{ option.label }} - {{ price or 0 }} and totals show numeric amounts without currency symbol.
Backend sanitization — AI REST
includes/AI/RestController.php
Removed defaulting blocks that injected currency_symbol (e.g., '$' / 'USD') during sanitize_form_fields, stopping automatic currency symbol population.
AI prompt — registration guidance
includes/AI/wpuf-ai-minimal-prompt-registration.md
Deleted the Pricing Fields (Pro) section and examples; added explicit rule prohibiting pricing fields in registration forms and guidance to direct paid-registration needs to membership/subscription solutions.
AI prompt — base guidance
includes/AI/wpuf-ai-minimal-prompt.md
Removed Currency Symbol section and updated pricing examples to drop currency_symbol, keeping only options/prices; adjusted cart_total/examples to use totals without currency prefixes.
Field templates & extraction
includes/AI/Field_Templates.php, includes/AI/Form_Builder.php
Removed default currency_symbol from pricing templates and stopped extracting currency_symbol into custom props for pricing_* and cart_total templates. No other property or signature changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • weDevsOfficial/wpuf-pro#1241 — Addresses the same removal of backend currency_symbol defaults and related FormSuccessStage.vue pricing rendering/caret changes.

Possibly related PRs

Suggested labels

needs: dev review

Suggested reviewers

  • sapayth
  • Rubaiyat-E-Mohammad

Poem

🐰 Numbers hop out, no symbol tied,
A tiny caret crowns the dropdown wide,
Registration springs—no prices near,
Post forms keep the coins so clear,
The rabbit skims the field with pride. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing currency symbols from AI form builder pricing fields across backend, frontend, and documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ddf1dbb and 065439c.

📒 Files selected for processing (3)
  • includes/AI/Field_Templates.php
  • includes/AI/Form_Builder.php
  • includes/AI/wpuf-ai-minimal-prompt-registration.md
💤 Files with no reviewable changes (2)
  • includes/AI/Field_Templates.php
  • includes/AI/Form_Builder.php
🔇 Additional comments (1)
includes/AI/wpuf-ai-minimal-prompt-registration.md (1)

404-414: Clear guidance on pricing field restrictions with appropriate feature redirection.

The new sections properly clarify that pricing fields are not allowed in registration forms and provide helpful redirection to WPUF's built-in Subscription feature. The prohibition is well-defined, and the AI instruction at lines 413-414 is actionable. The Subscription feature exists in WPUF Pro and is the correct recommendation for paid registration scenarios, addressing the past concern about suggesting third-party plugins.


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.
Copy link
Member

Choose a reason for hiding this comment

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

please recheck here with updated code from develop branch @arifulhoque7 bhai

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

Choose a reason for hiding this comment

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

please recheck here with updated code from develop branch @arifulhoque7 bhai

}
```
If a user requests pricing/payment functionality in a registration form:
- Inform them: "Pricing fields are only available for post forms, not registration forms. For membership subscriptions or paid registrations, please use a dedicated membership plugin alongside WPUF."
Copy link
Member

Choose a reason for hiding this comment

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

we should not suggest another membership plugin, we have membership feature in our own plugin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done @sapayth vai

@sapayth sapayth added needs: author reply This PR needs author feedback or code changes and removed needs: dev review This PR needs review by a developer labels Dec 30, 2025
arifulhoque7 and others added 2 commits December 30, 2025 11:41
Eliminated the 'currency_symbol' property from field templates and related logic in the form builder to streamline field configuration. Updated documentation to reference WPUF's built-in Subscription feature for paid registrations.
@arifulhoque7 arifulhoque7 added needs: dev review This PR needs review by a developer and removed needs: author reply This PR needs author feedback or code changes labels Dec 30, 2025
@arifulhoque7 arifulhoque7 requested a review from sapayth December 30, 2025 05:44
@sapayth sapayth added Dev Review Done and removed needs: dev review This PR needs review by a developer labels Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants