Skip to content

Fix category conditional logic in add-listing forms - #3009

Open
the-sohan wants to merge 1 commit into
sovware:developmentfrom
the-sohan:fix/ticket-6339-category-conditional-logic
Open

the-sohan wants to merge 1 commit into
sovware:developmentfrom
the-sohan:fix/ticket-6339-category-conditional-logic

Conversation

@the-sohan

@the-sohan the-sohan commented Sep 10, 2026

Copy link
Copy Markdown

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Description

Category-based conditional fields on the add-listing form did not react when a theme rendered an earlier category search dropdown. The conditional-value resolver used a combined selector followed by .first(), so document order could make it read the theme search field instead of the add-listing category field.

The resolver now explicitly prioritizes the canonical add-listing category select and falls back to the search-form category select only when the canonical field is absent. This keeps search-form support while ensuring add-listing conditions evaluate the category the user actually selected. The generated add-listing bundle is rebuilt from the source change.

How to reproduce the issue or test the changes:

  1. Use a theme that renders a category search select before the Directorist add-listing form, and configure a custom field to show when Category is Buy & Sell.
  2. Open the add-listing form and select Buy & Sell from its visible category Select2 control.
  3. Verify that the conditional field appears and its inputs are enabled; select Rent and verify that the field hides and its inputs are disabled.

Local verification:

  • Targeted production webpack build for assets/src/js/global/add-listing.js completed successfully.
  • Visible Select2 browser flow on the migrated local dService site: Buy & Sell showed and enabled Product Condition; Rent hid and disabled it.
  • git diff --check

Verification screenshot:

Category conditional logic verification

Notes:

  • A standalone ESLint check was unavailable because no ESLint configuration file could be resolved in this checkout.

Any linked issues

Checklist

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant