WC_Product_CSV_Exporter::get_default_column_namespublicWC 3.1.0

Return an array of columns to export.

Method of the class: WC_Product_CSV_Exporter{}

Returns

Array.

Usage

$WC_Product_CSV_Exporter = new WC_Product_CSV_Exporter();
$WC_Product_CSV_Exporter->get_default_column_names();

Changelog

Since 3.1.0 Introduced.

WC_Product_CSV_Exporter::get_default_column_names() code WC 10.8.1

public function get_default_column_names() {
	$weight_unit_label    = I18nUtil::get_weight_unit_label( get_option( 'woocommerce_weight_unit', 'kg' ) );
	$dimension_unit_label = I18nUtil::get_dimensions_unit_label( get_option( 'woocommerce_dimension_unit', 'cm' ) );

	$default_columns = array(
		'id'                 => __( 'ID', 'woocommerce' ),
		'type'               => __( 'Type', 'woocommerce' ),
		'sku'                => __( 'SKU', 'woocommerce' ),
		'global_unique_id'   => __( 'GTIN, UPC, EAN, or ISBN', 'woocommerce' ),
		'name'               => __( 'Name', 'woocommerce' ),
		'published'          => __( 'Published', 'woocommerce' ),
		'featured'           => __( 'Is featured?', 'woocommerce' ),
		'catalog_visibility' => __( 'Visibility in catalog', 'woocommerce' ),
		'short_description'  => __( 'Short description', 'woocommerce' ),
		'description'        => __( 'Description', 'woocommerce' ),
		'date_on_sale_from'  => __( 'Date sale price starts', 'woocommerce' ),
		'date_on_sale_to'    => __( 'Date sale price ends', 'woocommerce' ),
		'tax_status'         => __( 'Tax status', 'woocommerce' ),
		'tax_class'          => __( 'Tax class', 'woocommerce' ),
		'stock_status'       => __( 'In stock?', 'woocommerce' ),
		'stock'              => __( 'Stock', 'woocommerce' ),
		'low_stock_amount'   => __( 'Low stock amount', 'woocommerce' ),
		'backorders'         => __( 'Backorders allowed?', 'woocommerce' ),
		'sold_individually'  => __( 'Sold individually?', 'woocommerce' ),
		/* translators: %s: weight */
		'weight'             => sprintf( __( 'Weight (%s)', 'woocommerce' ), $weight_unit_label ),
		/* translators: %s: length */
		'length'             => sprintf( __( 'Length (%s)', 'woocommerce' ), $dimension_unit_label ),
		/* translators: %s: width */
		'width'              => sprintf( __( 'Width (%s)', 'woocommerce' ), $dimension_unit_label ),
		/* translators: %s: Height */
		'height'             => sprintf( __( 'Height (%s)', 'woocommerce' ), $dimension_unit_label ),
		'reviews_allowed'    => __( 'Allow customer reviews?', 'woocommerce' ),
		'purchase_note'      => __( 'Purchase note', 'woocommerce' ),
		'sale_price'         => __( 'Sale price', 'woocommerce' ),
		'regular_price'      => __( 'Regular price', 'woocommerce' ),
		'category_ids'       => __( 'Categories', 'woocommerce' ),
		'tag_ids'            => __( 'Tags', 'woocommerce' ),
		'shipping_class_id'  => __( 'Shipping class', 'woocommerce' ),
		'images'             => __( 'Images', 'woocommerce' ),
		'download_limit'     => __( 'Download limit', 'woocommerce' ),
		'download_expiry'    => __( 'Download expiry days', 'woocommerce' ),
		'parent_id'          => __( 'Parent', 'woocommerce' ),
		'grouped_products'   => __( 'Grouped products', 'woocommerce' ),
		'upsell_ids'         => __( 'Upsells', 'woocommerce' ),
		'cross_sell_ids'     => __( 'Cross-sells', 'woocommerce' ),
		'product_url'        => __( 'External URL', 'woocommerce' ),
		'button_text'        => __( 'Button text', 'woocommerce' ),
		'menu_order'         => __( 'Position', 'woocommerce' ),
	);

	if ( wc_get_container()->get( CostOfGoodsSoldController::class )->feature_is_enabled() ) {
		$default_columns['cogs_value'] = __( 'Cost of goods', 'woocommerce' );
	}

	return apply_filters(
		"woocommerce_product_export_{$this->export_type}_default_columns",
		$default_columns
	);
}