Codeinwp / Codeinwp/woocommerce-product-addon

Inactive first PPOM field group drops selected options from cart

Open
#705 2 comments 0 reactions 1 assignee View on GitHub

@girishpanchal30 is already working on this.

Since Aug 6, 2026.

  • #728 by @girishpanchal30 — merged
bug-report bug-report-triage customer report
Dominant language
PHP
Stars
15
Forks
9
Avg merge
3d 17h
Merged PRs (30d)
16

Description

Summary

When a product resolves multiple PPOM field groups and an inactive group is first in the resolved order, fields from a later active group can remain selectable on the product page, but their submitted values are omitted from the WooCommerce cart. The selected active options are expected to be stored with the cart item and displayed in the cart. Instead, the product is added without the selected PPOM option data, preventing stores from carrying customer selections into cart and checkout.

Customer context

  • Product / area: PPOM for WooCommerce, field-group resolution and add-to-cart handling
  • Version: PPOM 34.0.8; PPOM Pro 27.0.4
  • Environment: WooCommerce site; the behavior persisted with only WooCommerce, PPOM, and PPOM Pro enabled in troubleshooting mode
  • Integration / third party: No plugin conflict remained in the isolated test
  • Reported error / symptom: Selected add-on options were absent from the cart across affected products
  • Impact: Product option selections were not carried into the purchase flow; deleting unused inactive option sets restored operation

Reproduction notes

Reported workflow:

  1. Configure PPOM options on WooCommerce products, with unused option sets marked inactive.
  2. Select active add-on options on an affected product.
  3. Add the product to the cart.
  4. Observe that the PPOM selections are absent from the cart.
  5. Delete unused inactive option sets and repeat; the customer reported that selections then transferred correctly.

Source-confirmed minimal condition: a product resolves multiple groups with an inactive group first and an active group later. Runtime reproduction was not performed. The ticket does not provide the exported configuration or resolved assignment order.

Diagnosis

Conclusion

The defect is confirmed by source inspection. For a resolved group list ordered as [inactive, active], PPOM_Meta::settings() reduces the list to the first ID and returns no settings because that row is inactive. PPOM_Meta::get_fields() independently iterates all IDs, skips the inactive row, and retains fields from the active row. The product form can therefore expose active options while the add-to-cart handler exits before storing their submitted values. This code behavior directly aligns with the reported workaround, although the customer’s exact group assignments and ordering were not exported.

Where this likely occurs
  • Product-page PPOM field-group resolution in classes/ppom.class.phpPPOM_Meta::__construct() lines 124–135 initializes settings and fields through separate paths.
  • Primary settings selection in classes/ppom.class.phpPPOM_Meta::single_meta_id() lines 210–221 reduces a multi-group array to its first ID; PPOM_Meta::settings() lines 250–287 then filters that single row for inactive status.
  • Active field loading in classes/ppom.class.phpPPOM_Meta::get_fields() lines 297–327 iterates all resolved rows and retains fields from later active groups.
  • Cart metadata capture in src/WooCommerce/Cart/CartHandler.phpCartHandler::add_cart_item_data() lines 341–377 returns unchanged cart data when ppom_settings is empty, before assigning the posted PPOM payload.
  • Group ordering in src/Data/ProductConfigurationResolver.phpProductConfigurationResolver::merge_meta_ids_from_product_and_categories() lines 70–120 can produce multi-group arrays, with category-linked IDs first by default.
  • Git history indicates inactive-group filtering in PPOM_Meta::settings() entered in commit 34742e09 and is present from release v34.0.0 through the reported v34.0.8. The older first-ID reduction predates this release boundary.
Engineering notes

The confirmed path is in the free plugin, which owns normal WooCommerce cart capture. The Pro add-on extends cart editing and order-again workflows but does not replace this handler. The failure depends on resolved group ordering: an inactive group first and at least one active group later. Direct product assignments, category assignments, variation rules, or extension filters can influence that order. Arbitrary inactive groups that are not resolved for the product are not shown by the inspected code to trigger this path.

Test coverage status

tests/unit/test-field-group-toggle.php lines 112–152 covers one disabled group. Its multi-group case at lines 160–192 places the active group first and checks field visibility only, so it misses the disabled-first cart path. tests/unit/test-hotpath-cart-payload.php lines 21–63 verifies cart payload storage with one active group. No relevant coverage was found during inspection for a disabled-first, active-second group ordering followed by add-to-cart submission. Tests were inspected but not executed.

What to verify or explore next
  • May be worth reproducing with two directly assigned groups ordered inactive first and active second, then checking whether the active value appears in the classic WooCommerce cart.
  • May be worth repeating the reproduction with an inactive category-linked group preceding an active product-linked group.
  • If reproducible, npm run test:unit:php can exercise the relevant unit suites; the PPOM Playwright cart flow can confirm the browser-visible result.
  • A version comparison between v33.0.18 and v34.0.0 may further isolate the runtime regression boundary around inactive-group support.
Unknowns / follow-up

The ticket does not include an exported field group, resolved ID order, assignment type, product type, cart implementation, or exact inactive-group relationship to the affected products. Runtime reproduction was not performed in this investigation.

Confidence

Confidence: 96/100

Repository inspection confirms a reachable mismatch between multi-group field rendering and cart settings resolution in PPOM 34.0.8. The customer’s successful workaround, deleting inactive option sets, is consistent with the confirmed disabled-first group path, and no matching GitHub issue was found.


Source: HelpScout #3409300986
Generated by bug-report-triage (ID: bug-report-triage_6a736c2a1d9264.04163838)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.