We are running eventon-tickets 2.5.6 and hit a breaking change introduced in WooCommerce 10.8.0 that prevents all
variable ticket products using "Any" variations from being added to the cart.
Environment
- WordPress 7.0, WooCommerce 10.8.0, eventon-tickets 2.5.6, eventON 5.0.10
- LiteSpeed Cache 7.8.1, PHP 8.x
Reproduction
1. Create a variable WC product with a local attribute (e.g., "Pickup Location") with several options
2. Create one variation set to "Any" for that attribute (empty string in postmeta)
3. Assign the ticket to an EventOn event
4. On the frontend, select an option and click Add to Cart
5. Result: {"status":"bad"} or silent reject; item never enters cart
Root Cause
WC 10.8.0 introduced array_filter() inside WC_Cart::add_to_cart() (class-wc-cart.php line ~1163), which strips
empty-string "Any" slots from the stored variation array. Validation then expects the caller to pass the customer's
selection in the $variation parameter. WC_Form_Handler::add_to_cart_handler_variable() iterates $_REQUEST for
attribute_* keys and handles this; the eventon-tickets custom AJAX path does not. tx_script.js gathers
fields via .each() but skips elements - the variation dropdowns are selects, so the customer's selection
never makes it into the evotx_add_to_cart payload, $variation = array() is passed to cart, and WC throws " is a
required field".
Suggested Fixes
1. Preferred: In tx_script.js, add a SECTION.find('select').each(...) loop alongside the existing input loop to
include values in the payload. On the PHP side (class-event_ticket.php), read attribute_* POST keys and
pass them as $variation to WC()->cart->add_to_cart().
2. Register a fully plugin-controlled AJAX endpoint that accepts variation attributes explicitly.
3. Report upstream to WC: WC_AJAX::add_to_cart() should mirror WC_Form_Handler::add_to_cart_handler_variable() and
iterate $_POST for attribute_* keys.
Our Workaround
mu-plugin hooks evotx_add_ticket_to_cart_before and, when variation_id is set but $variation is empty with "Any"
slots, resolves attribute values from $_POST and calls WC()->cart->add_to_cart() directly. Site-specific patch we
would prefer to remove once the plugin handles this. (Confirmed working)