Skip to content

Conversation

@midu-01
Copy link
Contributor

@midu-01 midu-01 commented Jan 19, 2026

All Submissions:

  • My code follows the WordPress coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

This PR fixes an issue where the Admin → Vendor → Withdraw tab displayed
conflicting and misleading connection status messages when no withdrawal
methods were enabled
.

Previously, the UI showed:

  • “Connected” → No connected payment methods found
  • “Not Connected” → No disconnected payment methods found

This was confusing and incorrect when no withdrawal methods were configured.

The fix aligns the admin React UI behavior with the existing PHP
settings.php logic by properly validating active withdrawal methods
before rendering the withdraw interface.

Related Pull Request(s)

  • N/A

Closes

How to test the changes in this Pull Request:

  1. Create a vendor account.
  2. Disable all withdrawal/payment methods from Admin → Settings → Withdraw.
  3. Go to Admin → Vendors → Withdraw for that vendor.
  4. Verify that only the message
    “No withdraw method is available. Please enable payment method from settings.”
    is shown.
  5. Enable at least one withdrawal method.
  6. Reload the vendor Withdraw tab.
  7. Verify that:
    • Connected methods show correctly
    • Disconnected methods show correctly
    • No conflicting messages are displayed

Changelog entry

Fix admin withdraw tab conflicting connection status messages

Previously, the Admin Vendor Withdraw tab showed contradictory “Connected”
and “Not Connected” messages when no withdrawal methods were enabled.
This PR fixes the issue by ensuring the UI follows the same logic as the
settings page and renders a single, clear message when no methods are available.

Before Changes

  • Admin Withdraw tab showed:
    • “Connected” with “No connected payment methods found”
    • “Not Connected” with “No disconnected payment methods found”
  • UI was misleading when no withdrawal methods were enabled

After Changes

  • Admin Withdraw tab shows one clear message when no methods are enabled
  • Connected and Not Connected sections render only when applicable
  • Admin and Vendor behavior is now consistent

Feature Video (optional)

N/A

PR Self Review Checklist:

  • Code follows style guidelines
  • Naming is clear and understandable
  • KISS principle followed
  • DRY principle followed
  • Code is readable and maintainable
  • No performance issues introduced
  • No unnecessary complexity
  • Grammar and wording reviewed

Summary by CodeRabbit

  • New Features

    • Enhanced store settings API endpoint with payment method availability data.
  • Bug Fixes

    • Improved payment method display with graceful fallback handling.
    • Added informational alert when no payment methods are globally enabled.

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

@midu-01 midu-01 requested a review from mrabbani January 19, 2026 11:49
@midu-01 midu-01 self-assigned this Jan 19, 2026
@midu-01 midu-01 added Needs: Testing This requires further testing Needs: Dev Review It requires a developer review and approval labels Jan 19, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Caution

Review failed

The head commit changed during the review from 4277e50 to 62fab99.

📝 Walkthrough

Walkthrough

The pull request adds REST API integration to expose vendor payment method data in store settings responses, updates deprecated magic method signatures from __wakeup() to __unserialize(), and improves the admin withdraw tab UI to gracefully handle scenarios where no payment methods are configured.

Changes

Cohort / File(s) Summary
REST API Payment Methods Integration
includes/Dashboard/Templates/Settings.php
Added new public method add_payment_methods_to_rest_response() that fetches seller payment method data and augments REST store settings response with withdraw_methods_available, active_payment_methods, connected_methods, and disconnected_methods fields via the dokan_rest_store_settings_additional_fields filter.
Magic Method Modernization
includes/ReverseWithdrawal/ReverseWithdrawal.php, includes/Traits/ChainableContainer.php
Replaced deprecated __wakeup() magic method with __unserialize(array $data): void signature in both files, modernizing the unserialization entry point and adding proper type declarations.
Withdraw Tab Payment Method Resolution
src/admin/dashboard/pages/vendors-single/InformationTabs/Withdraw/WithdrawPaymentRow.tsx
Updated getPaymentMethodTitle() to use optional chaining and nullish coalescing with fallback chain: withdraw_options[selectedMethod]connected_methods[selectedMethod].titledisconnected_methods[selectedMethod].titleselectedMethod string.
Withdraw Tab Conditional Rendering
src/admin/dashboard/pages/vendors-single/InformationTabs/WithdrawTab.tsx
Added guard to check settings.active_payment_methods; if no active methods exist, renders an informational alert and skips rendering the Connected/Not Connected payment method sections, addressing UI conflicts when no withdrawal methods are configured.

Sequence Diagram

sequenceDiagram
    actor Client
    participant REST as REST API
    participant Settings as Settings Class
    participant Vendor as Vendor/Store Object
    participant PaymentMethods as Payment Methods Logic
    
    Client->>REST: GET /store-settings
    REST->>Settings: dokan_rest_store_settings_additional_fields filter
    Settings->>Vendor: Extract vendor_id from store object
    Settings->>PaymentMethods: get_seller_payment_methods(vendor_id)
    PaymentMethods-->>Settings: Payment method data
    Settings->>Settings: Augment response with<br/>withdraw_methods_available<br/>active_payment_methods<br/>connected_methods<br/>disconnected_methods
    Settings-->>REST: Enhanced additional_fields
    REST-->>Client: Store settings + payment methods
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested labels

QA approved, Dev Review Done

Suggested reviewers

  • mrabbani
  • MdAsifHossainNadim

Poem

🐰 A vendor's tale now clearer told,
With payment methods wrapped in gold,
No conflicting whispers on display,
The withdraw tab shows just one way—
Clear paths for merchants, bright and bold! 💳✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title is specific and directly describes the main change: fixing conflicting connection status messages in the admin withdraw tab, matching the issue number.
Description check ✅ Passed Description is comprehensive and follows the template well, including proposed changes, test steps, changelog, before/after sections, and self-review checklist completion.
Linked Issues check ✅ Passed The PR directly addresses issue #5343 by fixing the conflicting withdrawal method messages when none are enabled, validating active methods and showing a single clear message [#5343].
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the withdraw tab issue: REST API integration for payment methods, serialization updates for safety, and React UI guards for missing methods.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@dev-shahed
Copy link
Member

For your reference, @mrabbani, this issue was introduced by PR #3040
. It did not exist before this PR. Since the PR added several changes, we can look for a better solution while keeping its original intent in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Dev Review It requires a developer review and approval Needs: Testing This requires further testing QA In Progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants