Merge pull request #21810 from ghettifish/master

added an error for variation using variation for parent in import and…
This commit is contained in:
Claudiu Lodromanean 2018-11-06 15:56:27 -05:00 committed by GitHub
commit cae710c294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -84,7 +84,6 @@ abstract class WC_Product_Importer implements WC_Importer_Interface {
* (default value: 0)
*
* @var int
* @access protected
*/
protected $start_time = 0;
@ -434,6 +433,11 @@ abstract class WC_Product_Importer implements WC_Importer_Interface {
return new WP_Error( 'woocommerce_product_importer_missing_variation_parent_id', __( 'Variation cannot be imported: Missing parent ID or parent does not exist yet.', 'woocommerce' ), array( 'status' => 401 ) );
}
// Stop if parent is a product variation.
if ( $parent->is_type( 'variation' ) ) {
return new WP_Error( 'woocommerce_product_importer_parent_set_as_variation', __( 'Variation cannot be imported: Parent product cannot be a product variation', 'woocommerce' ), array( 'status' => 401 ) );
}
if ( isset( $data['raw_attributes'] ) ) {
$attributes = array();
$parent_attributes = $this->get_variation_parent_attributes( $data['raw_attributes'], $parent );