fix: clear vendor dashboard sale price when the field is blanked#3300
Merged
Conversation
The new product editor's price input coerced a cleared value with Number( '' ), which is 0, so blanking a sale price saved _sale_price = 0 and put the product on sale for 0 — the storefront then showed 0 instead of falling back to the regular price. Preserve a cleared price field as an empty string so WooCommerce removes the sale price instead of saving 0. Fixes getdokan/dokan-pro#5823 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesEmpty price field fix
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
…ing instead of zero
kzamanbd
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
In the new vendor-dashboard product editor, the price input (
PriceEdit) converted its value withNumber( rawValue ). When a price field is cleared,rawValueis an empty string andNumber( '' )is0, so blanking the Sale Price stored and sentsale_price: 0. WooCommerce then saved_sale_price = 0, which marks the product as on sale for0, and the storefront displayed0instead of falling back to the Regular Price.This PR preserves a cleared price field as an empty string (
'') instead of coercing it to0:WooCommerce treats an empty
sale_priceas "remove the sale price" (set_sale_price( '' )), so the product correctly reverts to its Regular Price. The server-sidePayloadResolveralready passes an empty string through unchanged, so no backend change is needed. The fix lives in the sharedPriceEditcomponent (used for every price field), so it is generic rather than specific to one field, and touches no global/shared components.Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
100) and a Sale Price (e.g.60), then Update.0).0.Changelog entry
Fix — Vendor dashboard Sale Price could not be removed once set
Previously, clearing the Sale Price field in the new vendor dashboard product editor saved the sale price as
0instead of removing it, so the storefront showed the product price as0. Now, blanking the Sale Price removes it and the product falls back to its Regular Price.Before Changes
Clearing the Sale Price and saving stored
_sale_price = 0; the product stayed "on sale" at0and the storefront showed0(verified:_sale_price=0,_price=0).After Changes
Clearing the Sale Price and saving removes
_sale_price; the product is no longer on sale and the storefront shows the Regular Price (verified:_sale_price='',_price=100,is_on_sale=no). Setting a Sale Price still works (verified:_sale_price=60, on sale).🤖 Generated with Claude Code
Summary by CodeRabbit
0.