Thanks for your reply. I understand what you are doing but the original behavior seems strange though. I have one product with two dynamic variations.
1. DateTime
2. Event
Both set to Any.
So when i’m add a product, i’m passing values for both DateTime and Event but still getting an error DateTime and Event are required fields.
$product_id = $body[‘ID’];
$quantity = $body[‘quantity’];
$variation_id = $body[‘variation_ID’];
$variations = array(
‘DateTime’ => $body[‘datetime’],
‘Event’ => $body[‘event’],
);
$result = WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations );
The $variations array seems to be ignored.
Hello, i’m having a similar issue with assigning dynamic variations. How did you resolve it?