WC_Product_CSV_Exporter::get_column_value_parent_id()protectedWC 3.1.0

Get parent_id value.

Method of the class: WC_Product_CSV_Exporter{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_column_value_parent_id( $product );
$product(WC_Product) (required)
Product being exported.

Changelog

Since 3.1.0 Introduced.

WC_Product_CSV_Exporter::get_column_value_parent_id() code WC 9.4.2

protected function get_column_value_parent_id( $product ) {
	if ( $product->get_parent_id( 'edit' ) ) {
		$parent = wc_get_product( $product->get_parent_id( 'edit' ) );
		if ( ! $parent ) {
			return '';
		}

		return $parent->get_sku( 'edit' ) ? $parent->get_sku( 'edit' ) : 'id:' . $parent->get_id();
	}
	return '';
}