Phone Orders For WooCommerce

Advanced Product Fields (Product Addons) for WooCommerce

Advanced Product Fields for WooCommerce (WAPF) by Studio Wombat adds custom product addon fields — text inputs, dropdowns, checkboxes, colour swatches, and more — that customers fill in when adding a product to their cart. Each selection stores a set of wapf_* keys in the cart item meta. Phone Orders for WooCommerce doesn’t carry these keys through its cart lifecycle automatically, so when an agent loads an existing order containing WAPF data the addon field selections are lost and the cart item rebuilds without them.

This snippet propagates all five WAPF meta keys through every stage of the Phone Orders cart lifecycle, ensuring addon field data survives cart item resolution, reloads, and updates.


Code Sample

Add the following snippet to your child theme’s functions.php or the Code Snippets plugin:

Code Explained (for Developers)

WAPF stores its addon selections across five cart item meta keys. The snippet propagates all five through three separate Phone Orders hooks that each represent a different stage in the cart item lifecycle.

WAPF meta keyDescription
wapfThe core addon field selections array — field IDs mapped to the customer’s chosen values.
wapf_keyA unique hash identifying the specific WAPF configuration for this cart item.
wapf_field_groupsThe field group definitions attached to the product, used by WAPF to render and validate the addon fields.
wapf_cloneTracks cloned field group instances when WAPF’s repeatable field groups feature is active.
wapf_item_priceThe additional price WAPF calculated for the selected addon options. Persisting this ensures the correct addon-inclusive price carries through the Phone Orders cart.
HookStagePurpose
wpo_get_item_by_productInitial item resolutionCopies WAPF keys from the source $item_data into the new Phone Orders item object when a product first resolves to a cart item.
wpo_update_cart_loaded_productCart reloadSyncs WAPF keys into the loaded product object when Phone Orders rebuilds a cart item from an existing cart or order. Also calls wc_get_formatted_cart_item_data() to generate the human-readable addon field summary displayed in the Phone Orders cart UI.
wpo_update_cart_cart_item_metaCart meta updateWrites all WAPF keys back into the WooCommerce cart item meta on every cart update, ensuring they persist in the WooCommerce session alongside the standard cart data.

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.
  4. Load an existing order that contains a product with WAPF addon field selections.
  5. Verify the addon field selections display correctly in the Phone Orders cart item and that the price includes any WAPF-based price additions.

⚠️ 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 when your store uses WAPF to add custom input fields to products and agents create or edit orders through Phone Orders PRO. Without it, addon field selections are lost when Phone Orders loads an existing order — the cart item shows the base product price without addon additions and the WAPF field data is missing from the order line item.

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