Skip to content

Conversation

@sbassah
Copy link
Contributor

@sbassah sbassah commented Dec 9, 2025

Context

The snippet wasn't working for the customer because they were using the Block based WooCommerce template. It turns out that the p.price selector only works when using the classic WooCommerce Template.

⛑️ Ticket(s): https://secure.helpscout.net/conversation/3150147153/94142?viewId=14964#thread-9643874904

Summary

The selector needs to be changed because not all WooCommerce themes or product pages use a

wrapper. By targeting .woocommerce-Price-amount bdi directly, the code becomes compatible with both classic and block-based WooCommerce templates, ensuring the price updates reliably across different setups.

@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

Walkthrough

DOM selector in the product configurator's price update script changed from a nested paragraph selector to a direct price container selector. The formatting logic remains unchanged.

Changes

Cohort / File(s) Change Summary
Price Display Selector Update
gs-product-configurator/gspc-update-wc-price-when-form-total-changes.js
Updated DOM selector for price amount element from nested paragraph selector to broader price container selector

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • saifsultanc
  • veryspry

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main change: updating the DOM selector for the price display in the WooCommerce price update script.
Description check ✅ Passed The description includes all required template sections with complete information: context with ticket reference, and summary explaining the selector change and its rationale.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sbassah-patch-1

📜 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 ba32383 and b683073.

📒 Files selected for processing (1)
  • gs-product-configurator/gspc-update-wc-price-when-form-total-changes.js (1 hunks)
🔇 Additional comments (1)
gs-product-configurator/gspc-update-wc-price-when-form-total-changes.js (1)

15-15: Selector change improves Woo block compatibility; verify impact where multiple prices exist

Using .woocommerce-Price-amount bdi should work across both classic and block-based templates, which aligns with the PR goal. The only caveat is that this will update all matching price amounts on the page (e.g., sticky headers, related products, other product blocks), not just the primary product’s price.

If that’s intentional, this looks good. If not, consider scoping the selector closer to the current form/product container (e.g., via .closest() from the form) so only the intended price element is updated.


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.

@sbassah sbassah requested review from claygriffiths and saifsultanc and removed request for claygriffiths December 9, 2025 13:03
Copy link
Contributor

@saifsultanc saifsultanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@saifsultanc saifsultanc merged commit 73b4230 into master Dec 11, 2025
7 checks passed
@saifsultanc saifsultanc deleted the sbassah-patch-1 branch December 11, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants