Skip to content

Commit

Permalink
v3.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Oct 19, 2023
1 parent d2df9b3 commit 2acf2e5
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cost-of-goods-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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: 3.0.8
Version: 3.0.9
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: cost-of-goods-for-woocommerce
Expand Down
80 changes: 78 additions & 2 deletions includes/analytics/class-alg-wc-cog-analytics-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Cost of Goods for WooCommerce - Analytics - Products.
*
* @version 2.7.6
* @version 3.0.9
* @since 2.5.1
* @author WPFactory
*/
Expand All @@ -16,7 +16,7 @@ class Alg_WC_Cost_of_Goods_Analytics_Products {
/**
* Constructor.
*
* @version 2.5.1
* @version 3.0.9
* @since 2.5.1
*
*/
Expand All @@ -29,17 +29,93 @@ function __construct() {
add_filter( 'woocommerce_analytics_clauses_join_products_stats_interval', array( $this, 'add_costs_to_join_products' ) );
add_filter( 'woocommerce_analytics_clauses_select_products', array( $this, 'add_costs_to_select_products' ) );
add_filter( 'woocommerce_analytics_clauses_select_products_subquery', array( $this, 'add_costs_to_select_products_subquery' ) );
add_filter( 'woocommerce_export_admin_products_report_row_data', array( $this, 'add_costs_row_data_to_export' ), PHP_INT_MAX, 2 );
add_filter( 'woocommerce_admin_products_report_export_column_names', array( $this, 'add_costs_columns_names_to_export' ), PHP_INT_MAX, 2 );
// Costs total
add_filter( 'woocommerce_analytics_clauses_select_products_stats_total', array( $this, 'add_costs_total_to_select_products_stats_total' ) );
add_filter( 'woocommerce_analytics_clauses_select_products_stats_interval', array( $this, 'add_costs_total_to_select_products_stats_total' ) );
// Profit
add_filter( 'woocommerce_analytics_clauses_select_products', array( $this, 'add_profit_to_select_products' ) );
add_filter( 'woocommerce_analytics_clauses_select_products_subquery', array( $this, 'add_profit_to_select_products_subquery' ) );
add_filter( 'woocommerce_export_admin_products_report_row_data', array( $this, 'add_profit_row_data_to_export' ), PHP_INT_MAX, 2 );
add_filter( 'woocommerce_admin_products_report_export_column_names', array( $this, 'add_profit_columns_names_to_export' ), PHP_INT_MAX, 2 );
// Profit total
add_filter( 'woocommerce_analytics_clauses_select_products_stats_total', array( $this, 'add_profit_total_to_select_products_stats_total' ) );
add_filter( 'woocommerce_analytics_clauses_select_products_stats_interval', array( $this, 'add_profit_total_to_select_products_stats_total' ) );
}

/**
* add_profit_row_data_to_export.
*
* @version 3.0.9
* @since 3.0.9
*
* @param $row
* @param $item
*
* @return mixed
*/
function add_costs_row_data_to_export( $row, $item ) {
if ( apply_filters( 'alg_wc_cog_analytics_product_profit_select', 'yes' === get_option( 'alg_wc_cog_cost_and_profit_column_on_products_tab', 'no' ) ) ) {
$row['cost'] = $item['cost'];
}
return $row;
}

/**
* add_profit_columns_names_to_export.
*
* @version 3.0.9
* @since 3.0.9
*
* @param $columns
* @param $exporter
*
* @return mixed
*/
function add_costs_columns_names_to_export( $columns, $exporter ) {
if ( apply_filters( 'alg_wc_cog_analytics_product_profit_select', 'yes' === get_option( 'alg_wc_cog_cost_and_profit_column_on_products_tab', 'no' ) ) ) {
$columns['cost'] = __( 'Cost', 'cost-of-goods-for-woocommerce' );
}
return $columns;
}

/**
* add_profit_row_data_to_export.
*
* @version 3.0.9
* @since 3.0.9
*
* @param $row
* @param $item
*
* @return mixed
*/
function add_profit_row_data_to_export( $row, $item ) {
if ( apply_filters( 'alg_wc_cog_analytics_product_profit_select', 'yes' === get_option( 'alg_wc_cog_cost_and_profit_column_on_products_tab', 'no' ) ) ) {
$row['profit'] = $item['profit'];
}
return $row;
}

/**
* add_profit_columns_names_to_export.
*
* @version 3.0.9
* @since 3.0.9
*
* @param $columns
* @param $exporter
*
* @return mixed
*/
function add_profit_columns_names_to_export( $columns, $exporter ) {
if ( apply_filters( 'alg_wc_cog_analytics_product_profit_select', 'yes' === get_option( 'alg_wc_cog_cost_and_profit_column_on_products_tab', 'no' ) ) ) {
$columns['profit'] = __( 'Profit', 'cost-of-goods-for-woocommerce' );
}
return $columns;
}

/**
* add_costs_total_to_select_products_stats_total.
*
Expand Down
2 changes: 1 addition & 1 deletion includes/class-alg-wc-cog.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class Alg_WC_Cost_of_Goods {
* @since 1.0.0
* @var string
*/
public $version = '3.0.8';
public $version = '3.0.9';

/**
* @since 1.0.0
Expand Down
6 changes: 4 additions & 2 deletions langs/cost-of-goods-for-woocommerce.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GNU General Public License v3.0.
msgid ""
msgstr ""
"Project-Id-Version: cost-of-goods-for-woocommerce 3.0.8\n"
"Project-Id-Version: cost-of-goods-for-woocommerce 3.0.9\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cost-of-goods-for-woocommerce\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2023-10-16T23:10:28+02:00\n"
"POT-Creation-Date: 2023-10-19T03:29:02+02:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.7.1\n"
"X-Domain: cost-of-goods-for-woocommerce\n"
Expand Down Expand Up @@ -71,6 +71,7 @@ msgid "Shipping classes cost"
msgstr ""

#: includes/analytics/class-alg-wc-cog-analytics-orders.php:379
#: includes/analytics/class-alg-wc-cog-analytics-products.php:78
#: includes/analytics/class-alg-wc-cog-analytics-revenue.php:47
#: includes/analytics/class-alg-wc-cog-analytics-stock.php:88
#: includes/class-alg-wc-cog-orders-meta-boxes.php:148
Expand All @@ -96,6 +97,7 @@ msgid "Cost"
msgstr ""

#: includes/analytics/class-alg-wc-cog-analytics-orders.php:415
#: includes/analytics/class-alg-wc-cog-analytics-products.php:114
#: includes/analytics/class-alg-wc-cog-analytics-revenue.php:48
#: includes/analytics/class-alg-wc-cog-analytics-stock.php:89
#: includes/class-alg-wc-cog-orders-meta-boxes.php:149
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: wpcodefactory, omardabbas, karzin, anbinder, algoritmika, kousikmu
Tags: woocommerce, cost, cost of goods, cog, cost of goods sold, cogs, woo commerce
Requires at least: 4.4
Tested up to: 6.3
Stable tag: 3.0.8
Stable tag: 3.0.9
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -98,6 +98,9 @@ And then you can follow these steps:

== Changelog ==

= 3.0.9 - 18/10/2023 =
* Fix - Analytics - Cost and Profit columns are not present in Products CSV sent by email.

= 3.0.8 - 16/10/2023 =
* Fix - Error message: CustomOrdersTableController is not being managed by the container.

Expand Down

0 comments on commit 2acf2e5

Please sign in to comment.