WordPress at Your Fingertips
function is not described

WC_Product_Variation::set_parent_data() public WC 3.0.0

Set the parent data array for this variation.

{} It's a method of the class: WC_Product_Variation{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Product_Variation = new WC_Product_Variation();
$WC_Product_Variation->set_parent_data( $parent_data );
$parent_data(array) (required)
parent data array for this variation.

Changelog

Since 3.0.0 Introduced.

Code of WC_Product_Variation::set_parent_data() WC 5.6.0

public function set_parent_data( $parent_data ) {
	$parent_data = wp_parse_args(
		$parent_data,
		array(
			'title'              => '',
			'status'             => '',
			'sku'                => '',
			'manage_stock'       => 'no',
			'backorders'         => 'no',
			'stock_quantity'     => '',
			'weight'             => '',
			'length'             => '',
			'width'              => '',
			'height'             => '',
			'tax_class'          => '',
			'shipping_class_id'  => 0,
			'image_id'           => 0,
			'purchase_note'      => '',
			'catalog_visibility' => 'visible',
		)
	);

	// Normalize tax class.
	$parent_data['tax_class'] = sanitize_title( $parent_data['tax_class'] );
	$parent_data['tax_class'] = 'standard' === $parent_data['tax_class'] ? '' : $parent_data['tax_class'];
	$valid_classes            = $this->get_valid_tax_classes();

	if ( ! in_array( $parent_data['tax_class'], $valid_classes, true ) ) {
		$parent_data['tax_class'] = '';
	}

	$this->parent_data = $parent_data;
}