woocommerce - Create Attributes and Linking Attributes to Product -
i'm having trouble creating attributes products using woocommerce. example have products have different color. main attribute color , variables red, orange , purple.
i have tried following unable set it.
wp_set_object_terms( 165, 'color', 'pa_colour' ); wp_set_object_terms( 165, array("red", "orange", "purple"), 'pa_colour' );
how create attributes first , link them product? there simple way first create attribute create variables link product?
update: i've been able research , able create attribute.
$wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', array( 'attribute_label' => $data['attributelabel'], 'attribute_name' => $data['attributename'], 'attribute_type' => $data['attributetype'], 'attribute_orderby' => $data['attributeorder'], ) );
however, when tried following code:
wp_set_object_terms (165, 'variable', 'product_type'); wp_set_object_terms( 165, array("ta", "tb"), 'pa_testing' );
i check backend see product linked attribute textbox values missing. not able enter variation page product.
anyone have idea?
Comments
Post a Comment