I am developing a plugin which is supposed to auto-fill the attributes text field.
There is a URL text field where user enters URL, on focus out I trigger a AJAX call through which I am able to save the data but I am looking to accomplish here is to show the saved data on highlighted fields as well.
I am using following code in a hook to display:
if( function_exists( 'wc_get_attribute_taxonomies' ) && ( $attribute_taxonomies = wc_get_attribute_taxonomies() ) ) {
$defaults = array();
$name = wc_attribute_taxonomy_name( $tax->attribute_name );
foreach ( $attribute_taxonomies as $key=>$tax ) {
$defaults[ $name ] = array (
'name' => $name,
'value' => 'thisTextShouldAppearInHighlightedFieldsOfScreenShot',
'position' => $key+1,
'is_visible' => 1,
'is_variation' => 1,
'is_taxonomy' => 1,
);
update_post_meta( $post->ID , '_product_attributes', $defaults );
}
Any help would be greatly appreciated!