the solution is:
foreach ($attributes as $attr => $value) {
$attr="pa_".$attr;
wp_set_object_terms($post_ID, $value, $attr);
$thedata[sanitize_title($attr)] = Array(
'name' => wc_clean($attr),
'value' => $value,
'postion' => '0',
'is_visible' => '1',
'is_variation' => '1',
'is_taxonomy' => '1'
);
}
update_post_meta($post_ID, '_product_attributes', $thedata);
Related Posts:
- Hiding taxonomies with no children WP_Query & tax_query
- get_the_term_list without links in 3.1
- How to get WooCommerce Product Category Link by ID?
- Creating custom Woocommerce attribute taxonomies from a plugin
- wp_insert_term – parent & child problem
- Custom order of terms for custom taxonomy in admin and website
- Custom Fields and performance
- Creating a custom Admin panel
- Remove description in custom taxonomy edit screen
- Approach for saving a product attribute values with a custom UI in a woocommerce+dokan set up [closed]
- get_the_term_list without specific category
- Set download limit and expiry for WooCommerce downloadable products in specific categories
- Remove pagination from WooCommerce product categories on admin edit navigation menus
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- Woocommerce custom taxonomies page
- Extending wordpress search to include excerpts and taxonomies?
- wp_query to display custom taxonomy terms
- Add attribute / custom attribute to product in woocommerce
- Outputting an array of term meta values in a custom WooCommerce tab?
- How to list all record from one custom taxonomy start with only one letter i.e A
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- Creating an Archive using a Custom Taxonomy
- Get child product categories from parent product category in WooCommerce
- Top level parent taxonomy ID
- List Recent Post Titles from Custom Taxonomies?
- Woocommerce product search result layout page
- Filter WooCommerce admin products list by a custom taxonomy
- Woocommerce: How to change the add to cart text in a certain category? [closed]
- Catchable fatal error on custom category post
- Get custom category image from menu
- Custom Taxonomy Term Caching?
- Hide product categories and taxonomy terms in menu if empty
- Display related products based on 2 specific product attributes values in WooCommerce
- How to target parent product category and its children using WooCommerce?
- Some of my custom taxonomies are not showing but still counted in a WPMU set up
- woocommerce custom product category template
- add hirarchy of categories in products grid of visual composer
- Getting WooCommerce product related child categories
- Add success message to category add screen
- wordpress testimonials
- WordPress Custom post query sorting does not work
- Custom taxonomy not appearing in menu administration panel
- Best structure for entering recipes in a WordPress theme?
- How to display ACF taxonomy checkbox links on WooCommerce product category archive
- Get Terms for Page
- Hide custom Woocommerce taxonomies when empty
- Best way to redirect taxonomy terms to pages
- Create alphabetical Pagination for custom taxonomy?
- Taxonomy Overview Page?
- Featured Images for Tags?
- Query Multiple Custom Taxonomies
- Use wp_list_categories to list parent categories from actual term
- Showing custom taxonomy in woocommerce signle product page
- Adding term to a custom taxonomy based on term from product category
- Warning: Undefined variable $post in C:\xampp\htdocs\… after PHP upgrade
- Admin only taxonomies?
- Fill New Taxonomies
- Infinite Scroll appending Next Product Category Term pages
- Query Product categories what have a custom field
- How to exclude woocommerece product category in search results?
- Cloning product not copying custom taxonomies
- Check if any available product has specific attribute
- how to show product custom taxonomies in woocommerce rest api
- Remove Custom metabox from particular page template is used
- Restrict viewing of posts by category, user role
- Assign a default description to new terms under a custom taxonomy
- WordPress search form and search result through ACF field in custom taxonomy
- Get user created Woocommerce attributes ( taxonomies ) [closed]
- Custom order of taxonomy using wp_get_object_terms and woocommerce_term_meta
- WordPress tag or archive php file customization
- Best Method to Switch Between Terms (Custom Taxonomy)
- WordPress shortcode Issue!
- How do you search for a post by custom taxonomy?
- Why is it defaulting to “uncategorized” even after I select a custom taxonomy
- Trying to achieve row posts below category with multiple loops in custom tax
- Custom Taxonomy, shows empty value (home page of website)
- Display woocommerce product_cat child terms with thumbnails
- Custom Search only for my Custom Taxonomy Page – data
- Woocommerce – how to get and display selected variations on single product page
- How do I check if a post has a term with a particular ancestor/parent?
- Creating a custom archive page for WooCommerce products based on tags
- Hide empty categories on widget
- Change order of Custom Taxonomy List
- Custom Taxonomy terms with latest post ordered by date pagination issue
- how to search in custom fields & custom taxonomy for custom search
- List Custom Taxonomy Based on Post Count & Category
- Custom taxonomies as product variations
- Echo specific term in an array
- Print terms with taxonomy and metabox value
- Automatically Update Woocommerce Prices [closed]
- Creating terms vs custom post meta to save data?
- Sticky posts or Featured posts only on Homepage
- How to set custom capabilities for custom taxonomies?
- Dropdown list of taxonomies won’t display selected
- Custom taxonomies registered via plugin stop existing after function finishes running
- How can I rewrite the URL of my custom taxonomy to include the year?
- Problem registering custom taxonomy
- Permalinks incorrectly inserting multiple categories
- Returning info from MYSQL table via custom taxonomy