I am using the following code to add attributes to a product:
$product_attr = get_post_meta(2, '_product_attributes',true);
$product_attr["pa_product-type"] = [
'name' => "pa_product-type",
'value' => '',
'is_visible' => '0',
'is_taxonomy' => '1'
];
wp_set_object_terms(2, "Caps", pa_product-type , true );
update_post_meta(2, '_product_attributes', $product_attr);
The attribute is getting updated successfully in the product and is showing up in product edit page. However, the attribute value is not getting updated in wp_wc_product_attributes_lookup
table. How to trigger update in this table after updating/adding attributes using the above code?