Create, update, save variations. Closes #1806.

This commit is contained in:
Mike Jolley 2012-11-27 10:33:58 +00:00
parent a7a681b38d
commit db1d4e58ed
3 changed files with 10 additions and 1 deletions

View File

@ -599,11 +599,16 @@ function process_product_meta_variable( $post_id ) {
'post_type' => 'product_variation',
'menu_order' => $variable_menu_order[ $i ]
);
$variation_id = wp_insert_post( $variation );
do_action( 'woocommerce_create_product_variation', $variation_id );
} else {
$wpdb->update( $wpdb->posts, array( 'post_status' => $post_status, 'post_title' => $variation_post_title, 'menu_order' => $variable_menu_order[ $i ] ), array( 'ID' => $variation_id ) );
do_action( 'woocommerce_update_product_variation', $variation_id );
}
@ -709,6 +714,8 @@ function process_product_meta_variable( $post_id ) {
}
}
do_action( 'woocommerce_save_product_variation', $variation_id );
}

View File

@ -230,7 +230,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Active plugins display on status page.
* Localization - French update by Arnaud Cheminand and absoluteweb.
* Localization - Romanian update by silviu-bucsa.
* Localization - Romanian update by silviu-bucsa and a1ur3l.
* Localization - Dutch updates by Ramoonus.
* Localization - Localized shortcode button.
* Localization - Norwegian translation by frilyd.

View File

@ -561,6 +561,8 @@ function woocommerce_add_variation() {
$variation_id = wp_insert_post( $variation );
do_action( 'woocommerce_create_product_variation', $variation_id );
if ( $variation_id ) {
$variation_post_status = 'publish';