Skip to content

Conversation

Aunshon
Copy link
Collaborator

@Aunshon Aunshon commented Sep 24, 2025

All Submissions:

  • My code follow 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

Closes

How to test the changes in this Pull Request:

  • Test as mentioned in the issue

Changelog entry

- **update:** Brand Field added in Vendor Product Creation Popup

@Aunshon Aunshon self-assigned this Sep 24, 2025
Copy link
Contributor

coderabbitai bot commented Sep 24, 2025

Walkthrough

Adds a product-brand selector to the Add Product popup (rendered with an empty brands array), adds an inline width style to the brand select, introduces a new hook invocation after the product category UI in new-product templates, and renames/extends Hooks methods to support add vs edit flows.

Changes

Cohort / File(s) Summary of Changes
Add-product popup templates
templates/products/tmpl-add-product-popup.php, templates/products/new-product.php
Inserted do_action( 'dokan_new_product_after_product_category' ); after the product category UI; included the product-brand partial into the add-product popup flow.
Product brand partial
templates/products/product-brand.php
Added style="width: 100%;" to the select (product_brand) markup; formatting preserved otherwise.
Product Hooks class
includes/Product/Hooks.php
Renamed add_product_brand_template()add_product_brand_template_in_edit_product( \WP_Post $post ), added add_product_brand_template_in_add_product(): void, and updated hook bindings to render brand template in add vs edit flows accordingly.

Sequence Diagram(s)

sequenceDiagram
  participant V as Vendor
  participant UI as Add Product Popup
  participant Loader as Template Loader
  participant Brand as product-brand Partial
  participant Hooks as Hooks Manager

  V->>UI: Open "Add New Product" popup
  UI->>Loader: Render popup template
  Loader->>Loader: Render Category UI
  Loader->>Hooks: do_action('dokan_new_product_after_product_category')
  Hooks->>Brand: add_product_brand_template_in_add_product() → include product-brand (product_brands = [])
  Brand-->>Loader: Return brand selector HTML
  Loader-->>UI: Compose form (Category → Brand → Tags)
  UI-->>V: Display popup with Brand field
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • mrabbani

Poem

"I hop through code with tiny feet,
A brand appears where categories meet.
Between the tags and UI glow,
A little field begins to show.
🥕🐇"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The Pull Request description includes the required checklist, issue link, and changelog entry but omits the “Changes proposed in this Pull Request” section and lacks an explicit outline of the changes and detailed test steps, making the description incomplete according to the repository template. Please add a “Changes proposed in this Pull Request” section summarizing the modifications and their rationale, and expand the testing section with concrete steps or screenshots for before and after behavior.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately describes the main change of including the product brand template in the add-product popup without extraneous details, making it clear for reviewers and consistent with the changeset.
Linked Issues Check ✅ Passed This change injects the dokan_new_product_after_product_category hook into the add-product popup template and binds add_product_brand_template_in_add_product to render the brand field immediately after the category UI, satisfying the linked issue’s acceptance criterion for displaying the Brand field in the vendor product creation popup.
Out of Scope Changes Check ✅ Passed All modifications center on introducing the new action hook for the add-product popup, rendering the brand field, adjusting its styling, and updating the edit flow hook, with no unrelated or extraneous changes detected outside the scope of displaying the Brand field in the product creation popup.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enhance/add-brand-in-product-create-popup

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0fecf4c and c67326d.

📒 Files selected for processing (3)
  • includes/Product/Hooks.php (3 hunks)
  • templates/products/new-product.php (1 hunks)
  • templates/products/tmpl-add-product-popup.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • templates/products/tmpl-add-product-popup.php
🧰 Additional context used
🧬 Code graph analysis (1)
includes/Product/Hooks.php (1)
includes/functions.php (1)
  • dokan_get_template_part (802-841)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: e2e tests (1, 3)
  • GitHub Check: e2e tests (2, 3)
  • GitHub Check: api tests (1, 1)
  • GitHub Check: e2e tests (3, 3)
🔇 Additional comments (2)
templates/products/new-product.php (1)

269-269: Brand hook placement looks spot on

Dropping dokan_new_product_after_product_category immediately after the category UI gives us a stable slot to render the brand selector (and future taxonomy fields) without upsetting the existing layout.

includes/Product/Hooks.php (1)

39-41: Hook wiring now covers both create & edit flows

Splitting the handlers so add_product_brand_template_in_add_product() feeds the new action while the renamed edit variant keeps the existing hook resolves the missing-brand gap without touching edit behaviour.

Also applies to: 587-608


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.

@Aunshon Aunshon added the In Progress The issues is being worked on label Sep 24, 2025
coderabbitai[bot]

This comment was marked as off-topic.

@Aunshon Aunshon added Needs: Testing This requires further testing Needs: Dev Review It requires a developer review and approval and removed In Progress The issues is being worked on labels Sep 29, 2025
@mrabbani mrabbani added Dev Review Done and removed Needs: Dev Review It requires a developer review and approval labels Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dev Review Done Needs: Testing This requires further testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants