-
Notifications
You must be signed in to change notification settings - Fork 91
gpnf-hide-quantity-in-summary-field-values.php
: Added snippet to hide quantity from GPNF summary field values.
#1101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…de quantity from GPNF summary field values.
WalkthroughA new PHP snippet was added to customize the display of product field values in Gravity Perks Nested Forms. The code hooks into the Changes
Sequence Diagram(s)sequenceDiagram
participant GravityForms
participant GPNFPlugin
participant CustomSnippet
GravityForms->>GPNFPlugin: Render Nested Form Summary
GPNFPlugin->>CustomSnippet: Apply gpnf_display_value filter
CustomSnippet->>CustomSnippet: Check if field type is 'product'
alt Field is product
CustomSnippet->>CustomSnippet: Remove quantity from display value
else Field is not product
CustomSnippet->>CustomSnippet: Return original display value
end
CustomSnippet-->>GPNFPlugin: Return modified display value
GPNFPlugin-->>GravityForms: Display summary with updated product label
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
gp-nested-forms/gpnf-hide-quantity-in-summary-field-values.php (1)
8-13
: Consider using strict comparison operator.The conditional check ensures only product fields are affected, which is appropriate. However, consider using the strict comparison operator
!==
instead of!=
for better type safety.- if ( $field->type != 'product' ) { + if ( $field->type !== 'product' ) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gp-nested-forms/gpnf-hide-quantity-in-summary-field-values.php
(1 hunks)
🔇 Additional comments (3)
gp-nested-forms/gpnf-hide-quantity-in-summary-field-values.php (3)
1-7
: Well-documented snippet purpose and functionality.The file header clearly explains what the snippet does and includes a link to the relevant documentation. This makes it easy for users to understand the purpose and context of this code.
14-14
: Verify regex robustness for all product label formats.The regex pattern removes the middle portion (quantity) from "Label, Quantity, Price". This works as long as the product labels don't contain commas themselves. If product labels could contain commas, this regex might remove too much content.
Consider testing with product labels that contain commas to ensure the regex behaves as expected. If needed, a more specific pattern that targets numeric quantities might be more robust.
8-17
: Good solution that addresses the specific requirement.The implementation effectively removes the quantity portion from product field display values in the Nested Forms summary, as requested in the PR objective. The approach is clean and focused on the specific problem.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2929910662/83058
Summary
To remove the quantity from the product data which is display on the Nested Forms Summary table.
The snippet is language independent!
Deutsch:

English:
