Permalink
Browse files

Have the taxonomies & product meta set after children are created whe…

…n duplicating product.

**Bug fix for the following issue:** Only the first product variant would be shown on the public product listing on a product that had been duplicated (original containing multiple variants). Turns out only the first term relationship was being kept during the duplication process (public page uses get_terms while admin uses custom query [which is why variants were still being shown there]… missing term relationships leads to missing variants called by get_terms).

Commenting out the wpsc_duplicate_children() function was a quick fix as it's 100% caused by that process, but that wasn't a good route to take. Settled on simply changing the order in which it happens… duplicate children first, and then taxonomies & product meta. *That fixed the issue!*
  • Loading branch information...
1 parent 005d474 commit 0ca11450b85858d791b18c8a2aa5e3ec9227a0a2 @KZeni committed Sep 5, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 wpsc-admin/admin.php
View
@@ -1402,15 +1402,15 @@ function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
// Insert the new template in the post table
$new_post_id = wp_insert_post($defaults);
+ // Finds children (Which includes product files AND product images), their meta values, and duplicates them.
+ wpsc_duplicate_children( $post->ID, $new_post_id );
+
// Copy the taxonomies
wpsc_duplicate_taxonomies( $post->ID, $new_post_id, $post->post_type );
// Copy the meta information
wpsc_duplicate_product_meta( $post->ID, $new_post_id );
- // Finds children (Which includes product files AND product images), their meta values, and duplicates them.
- wpsc_duplicate_children( $post->ID, $new_post_id );
-
return $new_post_id;
}

0 comments on commit 0ca1145

Please sign in to comment.