I'm programmatically creating attribute variations (variable product). Everything I've seen does this easily, but the value simply does not show up. Here's my code:
$thedata = Array(
'pa_performance_dates' => Array(
'name' => 'pa_performance_dates',
'value' => $arrayOfTermIDs,
'position' => 1,
'is_visible' => '1',
'is_variation' => '1',
'is_taxonomy' => '1'
)
);
update_post_meta( $product_id, '_product_attributes', $thedata );
Attribute: "Performance Dates" WORKING
Attribute Values (terms under attribute): "1571986800" WORKING
Attribute Values being added under the Product ID: NOT WORKING
I have tried everything: setting the VALUE above to an array of the terms slugs, an array of the IDs, a simple string of an ID or slug/value. Nothing works.
I've also followed these stackoverflow questions:
woocommerce: add value to a product attribute
Creating WooCommerce product variation adds an empty attribute value
Add Product Attributes with values to a product in Woocommerce
I've also tested the product_id variable and that is correctly showing the ID of the post.
What am I doing wrong?!?!?!?