Merge pull request #21810 from ghettifish/master
added an error for variation using variation for parent in import and…
This commit is contained in:
commit
cae710c294
|
@ -84,7 +84,6 @@ abstract class WC_Product_Importer implements WC_Importer_Interface {
|
||||||
* (default value: 0)
|
* (default value: 0)
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
* @access protected
|
|
||||||
*/
|
*/
|
||||||
protected $start_time = 0;
|
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 ) );
|
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'] ) ) {
|
if ( isset( $data['raw_attributes'] ) ) {
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
$parent_attributes = $this->get_variation_parent_attributes( $data['raw_attributes'], $parent );
|
$parent_attributes = $this->get_variation_parent_attributes( $data['raw_attributes'], $parent );
|
||||||
|
|
Loading…
Reference in New Issue