Automattic\WooCommerce\Internal\CostOfGoodsSold
CostOfGoodsSoldController::add_debug_tools_entry()
Add the entry for "add/remove COGS value column to/from the product meta lookup table" to the WooCommerce admin tools.
Метод класса: CostOfGoodsSoldController{}
Хуков нет.
Возвращает
Массив
. Updated tools array.
Использование
$CostOfGoodsSoldController = new CostOfGoodsSoldController(); $CostOfGoodsSoldController->add_debug_tools_entry( $tools_array ): array;
- $tools_array(массив) (обязательный)
- Array to add the tool to.
Код CostOfGoodsSoldController::add_debug_tools_entry() CostOfGoodsSoldController::add debug tools entry WC 9.8.1
public function add_debug_tools_entry( array $tools_array ): array { // If the feature is disabled we show the tool for removing the column, but not for adding it. $column_exists = $this->product_meta_lookup_table_cogs_value_columns_exist(); if ( ! $this->feature_is_enabled() && ! $column_exists ) { return $tools_array; } $tools_array['generate_cogs_value_meta_column'] = array( 'name' => $column_exists ? __( 'Remove COGS columns from the product meta lookup table', 'woocommerce' ) : __( 'Create COGS columns in the product meta lookup table', 'woocommerce' ), 'button' => $column_exists ? __( 'Remove columns', 'woocommerce' ) : __( 'Create columns', 'woocommerce' ), 'desc' => $column_exists ? __( 'This tool will remove the Cost of Goods Sold (COGS) related columns from the product meta lookup table. COGS will continue working (if the feature is enabled) but some functionality will not be available.', 'woocommerce' ) : __( 'This tool will generate the necessary Cost of Goods Sold (COGS) related columns in the product meta lookup table, and populate them from existing product data.', 'woocommerce' ), 'callback' => $column_exists ? array( $this, 'remove_lookup_cogs_columns' ) : array( $this, 'generate_lookup_cogs_columns' ), ); return $tools_array; }