-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Add to Cart + Options: make sure individually sold products quantities are reset when they are children of a grouped product #59597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ntities are reset when they are children of a grouped product
📝 WalkthroughWalkthroughA patch was applied to the WooCommerce Add to Cart + Options block to correctly handle grouped products containing individually sold child items. The update changes the logic so that child products with a requested quantity of zero are skipped earlier in the process, ensuring their quantities are reset appropriately. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AddToCartBlock
participant Cart
User->>AddToCartBlock: Submit grouped product with options
loop For each child product
AddToCartBlock->>AddToCartBlock: Check requested quantity
alt Quantity > 0
AddToCartBlock->>Cart: Compute and update quantity
else Quantity == 0
AddToCartBlock-->>Cart: Skip updating this child product
end
end
AddToCartBlock->>User: Return updated cart state
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)`**/*.{php,js,ts,jsx,tsx}`: Don't trust that extension developers will follow th...
⚙️ Source: CodeRabbit Configuration File List of files the instruction was applied to:
🧠 Learnings (3)📓 Common learnings
plugins/woocommerce/changelog/fix-59596-individually-sold-grouped-product (5)
plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/frontend.ts (10)
⏰ 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). (3)
🔇 Additional comments (2)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Size Change: +3 B (0%) Total Size: 5.85 MB |
Testing GuidelinesHi @dinhtungdu , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is looking and testing good to me.
🖼️ Screenshots/ screen recordings
Screen.Recording.2025-07-11.at.09.59.16.mov
🌐 Site details
System Status Report
### WordPress Environment ###
WordPress address (URL): [Redacted]
Site address (URL): [Redacted]
WC Version: 10.1.0-dev
Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site.
Action Scheduler Version: ✔ 3.9.2
Log Directory Writable: ✔
WP Version: 6.8.1
WP Multisite: –
WP Memory Limit: 2 GB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US
External object cache: –
### Server Environment ###
Server Info: nginx/1.25.4
Server Architecture: Darwin 24.5.0 arm64
PHP Version: 7.4.33
PHP Post Max Size: 8 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 8.5.0
OpenSSL/3.1.4
SUHOSIN Installed: –
MySQL Version: 8.0.33
Max Upload Size: 2 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔
### Database ###
[REDACTED]
### Post Type Counts ###
attachment: 25
global_product_addon: 1
page: 20
post: 3
product: 18
product_tab: 1
product_variation: 7
revision: 200
wp_font_face: 36
wp_font_family: 12
wp_global_styles: 4
wp_navigation: 1
wp_template: 7
wp_template_part: 7
### Security ###
Secure connection (HTTPS): ✔
Hide errors from visitors: ❌Error messages should not be shown to visitors.
### Active Plugins (3) ###
Gutenberg: by Gutenberg Team – 20.7.0-rc.1
Laravel DD for Wordpress: by Peter Hegman – 1.0.1
WooCommerce: by Automattic – 10.1.0-dev
### Inactive Plugins (15) ###
Akismet Anti-spam: Spam Protection: by Automattic - Anti-spam Team – 5.3.6
bbPress: by The bbPress Contributors – 2.6.13
Block Hooks Experiments for WooCommerce: by Automattic –
Custom Product Tabs Manager: by Addify – 1.2.2
Extra product options For WooCommerce | Custom Product Addons and Fields: by ThemeHigh – 3.3.2
Hello Dolly: by Matt Mullenweg – 1.7.2
Product Filters for WooCommerce: by WooCommerce – 1.4.38
Query Monitor: by John Blackbourn – 3.17.2
What Can Wp Scripts Do: by The WordPress Contributors – 0.1.0
WooCommerce: by Automattic – 9.7.1 (update to version 9.9.5 is available)
WooCommerce Beta Tester: by WooCommerce – 3.0.0
WooCommerce PayPal Payments: by PayPal – 3.0.0 (update to version 3.0.7 is available)
WooCommerce Product Add-Ons: by Woo – 7.8.1 (update to version 7.9.1 is available)
WooPayments: by WooCommerce – 9.1.0 (update to version 9.6.0 is available)
WP BASIC Auth: by wokamoto – 1.1.4
### Must Use Plugins (1) ###
WooCommerce Product Details Extension Demo: by – 1.0.0
### Settings ###
Legacy API Enabled: –
Force SSL: –
Currency: USD ($)
Currency Position: right_space
Thousand Separator: .
Decimal Separator: ,
Number of Decimals: 1
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)
Connected to WooCommerce.com: –
Enforce Approved Product Download Directories: ✔
HPOS feature enabled: ✔
Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
HPOS data sync enabled: –
Enabled Features: analytics
product_block_editor
marketplace
order_attribution
site_visibility_badge
remote_logging
email_improvements
point_of_sale
custom_order_tables
### Logging ###
Enabled: ✔
Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2
Retention period: 30 days
Level threshold: –
Log directory size: 5 MB
### WC Pages ###
Shop base: #7 - /shop/
Cart: #8 - /cart/ - Contains the woocommerce/cart block
Checkout: #9 - /checkout/ - Contains the woocommerce/checkout block
My account: #10 - /my-account/ - Contains the [woocommerce_my_account] shortcode
Terms and conditions: ❌ Page not set
### Theme ###
Name: woostarter
Version: 0.1.0
Author URL: https://automattic.com/
Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
Theme type: Block theme
WooCommerce Support: ❌ Not declared
### Templates ###
Overrides: /Users/tung/workspace/woocommerce/plugins/woocommerce/templates/block-notices/error.php
/Users/tung/workspace/woocommerce/plugins/woocommerce/templates/block-notices/notice.php
/Users/tung/workspace/woocommerce/plugins/woocommerce/templates/block-notices/success.php
woostarter/templates/archive-product.html
woostarter/templates/coming-soon.html
woostarter/templates/order-confirmation.html
woostarter/templates/page-cart.html
woostarter/templates/product-search-results.html
woostarter/templates/single-product.html
### Admin ###
Enabled Features: activity-panels
analytics
product-block-editor
experimental-blocks
coupons
core-profiler
customize-store
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
minified-js
mobile-app-banner
onboarding
onboarding-tasks
pattern-toolkit-full-composability
payment-gateway-suggestions
product-custom-fields
printful
remote-inbox-notifications
remote-free-extensions
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page
async-product-editor-category-field
launch-your-store
add-to-cart-with-options-stepper-layout
Disabled Features: product-data-views
experimental-iapi-mini-cart
experimental-iapi-runtime
coming-soon-newsletter-template
product-pre-publish-modal
settings
product-editor-template-system
use-wp-horizon
Daily Cron: ✔ Next scheduled: 2025-07-11 10:10:56 +00:00
Options: ✔
Notes: 81
Onboarding: completed
### Action Scheduler ###
Complete: 160
Oldest: 2025-06-10 03:10:40 +0000
Newest: 2025-07-11 02:58:08 +0000
Failed: 2
Oldest: 2025-03-05 03:00:25 +0000
Newest: 2025-06-05 11:13:52 +0000
Pending: 2
Oldest: 2025-07-11 14:58:08 +0000
Newest: 2025-07-12 02:58:08 +0000
### Status report information ###
Generated at: 2025-07-11 03:05:11 +00:00
Changes proposed in this Pull Request:
Closes #59596.
How to test the changes in this Pull Request:
Enregistrament.de.pantalla.a.2025-07-10.15-24-02.mp4