Fixed tags and shipping class parsers warnings
wp_insert_term() returns array with `term_id` and `term_taxonomy_id` only.
This commit is contained in:
parent
d20c61678c
commit
2ebea10be6
|
@ -226,14 +226,14 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$names = array_map( 'wc_clean', array_map( 'trim', explode( ',', $field ) ) );
|
$names = array_map( 'trim', explode( ',', $field ) );
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
|
||||||
foreach ( $names as $name ) {
|
foreach ( $names as $name ) {
|
||||||
$term = get_term_by( 'name', $name, 'product_tag' );
|
$term = get_term_by( 'name', $name, 'product_tag' );
|
||||||
|
|
||||||
if ( ! $term ) {
|
if ( ! $term ) {
|
||||||
$term = wp_insert_term( $name, 'product_tag' );
|
$term = (object) wp_insert_term( $name, 'product_tag' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags[] = $term->term_id;
|
$tags[] = $term->term_id;
|
||||||
|
@ -252,7 +252,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
||||||
$term = get_term_by( 'name', $field, 'product_shipping_class' );
|
$term = get_term_by( 'name', $field, 'product_shipping_class' );
|
||||||
|
|
||||||
if ( ! $term ) {
|
if ( ! $term ) {
|
||||||
$term = wp_insert_term( $name, 'product_shipping_class' );
|
$term = (object) wp_insert_term( $name, 'product_shipping_class' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $term->term_id;
|
return $term->term_id;
|
||||||
|
|
Loading…
Reference in New Issue