Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. $thedata = array();
  2. foreach ( $artikel->attributes->attribute as $property ) {
  3. $attribute_name = 'pa_' .sanitize_title_with_dashes($property->attributes()->name);
  4. $attribute_value = $property->attributes()->value;
  5.  
  6. wp_set_object_terms( $insertProduct, (string)$attribute_value, $attribute_name , true);
  7.  
  8. $thedata[$attribute_name] = array(
  9. 'name'=> $attribute_name,
  10. 'value'=> (string)$attribute_value,
  11. 'is_visible' => '1',
  12. 'is_variation' => '1',
  13. 'is_taxonomy' => '1'
  14. );
  15. }
  16. update_post_meta( $insertProduct,'_product_attributes', $thedata) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement