WC_Product_CSV_Exporter::prepare_linked_products_for_export()protectedWC 3.1.0

Prepare linked products for export.

Method of the class: WC_Product_CSV_Exporter{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_linked_products_for_export( $linked_products );
$linked_products(int[]) (required)
Array of linked product ids.

Changelog

Since 3.1.0 Introduced.

WC_Product_CSV_Exporter::prepare_linked_products_for_export() code WC 8.7.0

protected function prepare_linked_products_for_export( $linked_products ) {
	$product_list = array();

	foreach ( $linked_products as $linked_product ) {
		if ( $linked_product->get_sku() ) {
			$product_list[] = $linked_product->get_sku();
		} else {
			$product_list[] = 'id:' . $linked_product->get_id();
		}
	}

	return $this->implode_values( $product_list );
}