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,12 +599,17 @@ function process_product_meta_variable( $post_id ) {
'post_type' => 'product_variation', 'post_type' => 'product_variation',
'menu_order' => $variable_menu_order[ $i ] 'menu_order' => $variable_menu_order[ $i ]
); );
$variation_id = wp_insert_post( $variation ); $variation_id = wp_insert_post( $variation );
do_action( 'woocommerce_create_product_variation', $variation_id );
} else { } 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 ) ); $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 );
} }
// Update post meta // Update post meta
@ -710,6 +715,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. * Fix - Active plugins display on status page.
* Localization - French update by Arnaud Cheminand and absoluteweb. * 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 - Dutch updates by Ramoonus.
* Localization - Localized shortcode button. * Localization - Localized shortcode button.
* Localization - Norwegian translation by frilyd. * Localization - Norwegian translation by frilyd.

View File

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