Phone Orders For WooCommerce

WooCommerce Composite Products

WooCommerce Composite Products lets customers build configurable product sets from selectable components. Each composite product generates a parent cart item plus child component items, all linked by composite_data, composite_parent, and composite_children meta keys. Phone Orders for WooCommerce doesn’t recognise the composite product type by default, and its cart update logic doesn’t carry composite relationship meta through rebuilds — breaking the parent-child structure and causing incorrect pricing when agents load or edit composite orders.

This snippet registers the composite product type, preserves all composite relationship data through cart updates, locks prices on both parent and child items, and prevents Phone Orders from double-adding component items that composites manage internally.


Code Sample

Code Explained (for Developers)

The snippet covers the full lifecycle of a composite product inside Phone Orders — from search, through cart building, to order loading.

HookPurpose
wpo_search_product_typesRegisters 'composite' so composite products appear in Phone Orders product search.
wpo_skip_add_to_cart_itemPrevents Phone Orders from re-adding component child items independently. WooCommerce Composite Products adds children automatically when the parent is added — Phone Orders must not add them a second time.
wpo_is_child_cart_itemMarks items with a composite_parent key as child items in Phone Orders’ cart structure, so they nest correctly under their parent in the UI.
wpo_children_cart_itemPasses the composite_children array to Phone Orders so it can correctly associate child item cart keys with their parent.
wpo_cart_item_is_price_readonlyLocks the price field for both parent items (which have composite_children) and child items (which have composite_parent). Composite pricing is calculated by WooCommerce Composite Products from component selections — manual agent edits would break this.
wpo_update_cart_cart_item_meta and wpo_update_cart_loaded_productPersist composite_data and readonly_price through every cart update and reload cycle, preventing composite configuration data from being lost when Phone Orders rebuilds the cart.
wpo_get_item_by_productPasses composite_data to the Phone Orders item object on resolution, with a fallback that reads _composite_data from order item meta when loading existing orders. Also removes _composite_data from custom_meta_fields to prevent it appearing as a raw meta display in the UI.
wpo_add_configured_products_skip_itemSkips child items when Phone Orders reconstructs a configured product set, since the composite parent’s add-to-cart handles children.
wpo_load_order_skip_itemSkips composite child items when loading an existing order into Phone Orders — again because the parent’s add-to-cart re-creates them.
wpo_add_configured_products_item_dataExtracts the composite parent’s readonly price from the WooCommerce cart price HTML using a regex pattern that accounts for the store’s decimal and thousand separators.

How to Apply This Code

  1. Open Appearance → Theme File Editor or the Code Snippets plugin.
  2. Paste the full snippet into your child theme’s functions.php or create a new dedicated snippet.
  3. Save and open Phone Orders. Search for a composite product and confirm it appears in results.
  4. Add it to the cart and verify the component selections, pricing, and parent-child structure display correctly.
  5. Load an existing order containing a composite product and confirm the configuration data loads intact.

⚠️ Always use a child theme or Code Snippets — parent theme files get overwritten on theme updates.


When Should You Use This Fix?

This fix applies whenever your store uses WooCommerce Composite Products and agents create or edit orders through Phone Orders PRO. Without it, composite products don’t appear in search, component data is lost on cart updates, and child items get added twice — producing incorrect order structures and prices.

Have questions? Please submit a support request. We're always happy to help!

Phone Orders
for WooCommerce
PRO

From $120
Buy
✓ 30-day money-back guarantee