Skip to content

Commit

Permalink
Showing 4 changed files with 85 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cost-of-goods-for-woocommerce.php
Original file line number Diff line number Diff line change
@@ -3,13 +3,13 @@
Plugin Name: Cost of Goods for WooCommerce
Plugin URI: https://wpfactory.com/item/cost-of-goods-for-woocommerce/
Description: Save product purchase costs (cost of goods) in WooCommerce. Beautifully.
Version: 2.9.9
Version: 3.0.1
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: cost-of-goods-for-woocommerce
Domain Path: /langs
Copyright: © 2023 WPFactory
WC tested up to: 7.7
WC tested up to: 7.8
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
@@ -72,7 +72,7 @@ final class Alg_WC_Cost_of_Goods {
* @var string
* @since 1.0.0
*/
public $version = '2.9.9';
public $version = '3.0.1';

/**
* @var Alg_WC_Cost_of_Goods The single instance of the class
56 changes: 53 additions & 3 deletions includes/analytics/class-alg-wc-cog-analytics-orders.php
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
/**
* Cost of Goods for WooCommerce - Analytics - Orders.
*
* @version 2.9.8
* @version 3.0.0
* @since 2.4.5
* @author WPFactory
*/
@@ -16,8 +16,8 @@ class Alg_WC_Cost_of_Goods_Analytics_Orders {
/**
* Constructor.
*
* @version 2.4.8
* @since 2.4.5
* @version 3.0.0
* @since 3.0.0
*
* @see https://github.com/woocommerce/woocommerce-admin/tree/master/docs/examples/extensions
* @see https://woocommerce.wordpress.com/2020/02/20/extending-wc-admin-reports/
@@ -56,6 +56,10 @@ function __construct() {
add_filter( 'woocommerce_admin_orders_report_export_column_names', array( $this, 'add_profit_columns_names_to_export' ), PHP_INT_MAX, 2 );
add_filter( 'alg_wc_cog_analytics_orders_profit_total_validation', array( $this, 'add_profit_total_column_if_option_is_enabled' ) );

// Individual Costs export
add_filter( 'woocommerce_export_admin_orders_report_row_data', array( $this, 'add_individual_costs_row_data_to_export' ), PHP_INT_MAX, 2 );
add_filter( 'woocommerce_admin_orders_report_export_column_names', array( $this, 'add_individual_costs_columns_names_to_export' ), PHP_INT_MAX, 2 );

// Test, Debug
// woocommerce_analytics_orders_stats_select_query
// woocommerce_analytics_orders_stats_query_args
@@ -79,6 +83,52 @@ function __construct() {
return $param;
}*/

/**
* add_individual_costs_columns_names_to_export.
*
* @version 3.0.0
* @since 3.0.0
*
* @param $columns
* @param $exporter
*
* @return mixed
*/
function add_individual_costs_columns_names_to_export( $columns, $exporter ) {
if ( 'yes' === get_option( 'alg_wc_cog_analytics_orders_individual_costs', 'no' ) ) {
$columns['items_cost'] = __( 'Items cost', 'cost-of-goods-for-woocommerce' );
$columns['shipping_cost'] = __( 'Shipping cost', 'cost-of-goods-for-woocommerce' );
$columns['gateway_cost'] = __( 'Gateway cost', 'cost-of-goods-for-woocommerce' );
$columns['extra_cost'] = __( 'Extra cost', 'cost-of-goods-for-woocommerce' );
$columns['shipping_classes_cost'] = __( 'Shipping classes cost', 'cost-of-goods-for-woocommerce' );
}

return $columns;
}

/**
* add_individual_costs_row_data_to_export.
*
* @version 3.0.0
* @since 3.0.0
*
* @param $row
* @param $item
*
* @return mixed
*/
function add_individual_costs_row_data_to_export( $row, $item ) {
if ( 'yes' === get_option( 'alg_wc_cog_analytics_orders_individual_costs', 'no' ) ) {
$row['items_cost'] = $item['items_cost'];
$row['shipping_cost'] = $item['shipping_cost'];
$row['gateway_cost'] = $item['gateway_cost'];
$row['extra_cost'] = $item['extra_cost'];
$row['shipping_classes_cost'] = $item['shipping_classes_cost'];
}

return $row;
}

/**
* add_analytics_localization_info.
*
24 changes: 22 additions & 2 deletions langs/cost-of-goods-for-woocommerce.pot
Original file line number Diff line number Diff line change
@@ -10,7 +10,27 @@ msgstr ""
msgid "Cost of Goods for WooCommerce Pro"
msgstr ""

#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:309
#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:99
msgid "Items cost"
msgstr ""

#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:100
msgid "Shipping cost"
msgstr ""

#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:101
msgid "Gateway cost"
msgstr ""

#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:102
msgid "Extra cost"
msgstr ""

#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:103
msgid "Shipping classes cost"
msgstr ""

#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:359
#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-revenue.php:47
#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-stock.php:88
#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\class-alg-wc-cog-orders-meta-boxes.php:145
@@ -30,7 +50,7 @@ msgstr ""
msgid "Cost"
msgstr ""

#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:345
#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-orders.php:395
#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-revenue.php:48
#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\analytics\class-alg-wc-cog-analytics-stock.php:89
#: E:\xampp\htdocs\wpfactory-local\wp-content\plugins\cost-of-goods-for-woocommerce-pro\includes\class-alg-wc-cog-orders-meta-boxes.php:146
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ Contributors: wpcodefactory, karzin, kerbhavik, jaedm97, algoritmika, anbinder,
Tags: woocommerce, cost, cost of goods, cog, cost of goods sold, cogs, woo commerce
Requires at least: 4.4
Tested up to: 6.2
Stable tag: 2.9.9
Stable tag: 3.0.1
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

@@ -98,6 +98,12 @@ And then you can follow these steps:

== Changelog ==

= 3.0.1 - 17/06/2023 =
* WC tested up to: 7.8.

= 3.0.0 - 13/06/2023 =
* Dev - Tools - Analytics - Orders - Individual elements should be present on the CSV.

= 2.9.9 - 25/05/2023 =
* Update function Alg_WC_Cost_of_Goods_Products() ->get_product_price() with condition if product object exist or not .

0 comments on commit 73bc8b8

Please sign in to comment.