Skip to content

Commit

Permalink
v3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Dec 20, 2023
1 parent 9cc0ab2 commit 58a5cd0
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 24 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.1.9
Version: 3.2.0
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: cost-of-goods-for-woocommerce
Expand Down
40 changes: 35 additions & 5 deletions includes/class-alg-wc-cog-orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Cost of Goods for WooCommerce - Orders Class.
*
* @version 3.1.9
* @version 3.2.0
* @since 2.1.0
* @author WPFactory
*/
Expand Down Expand Up @@ -248,6 +248,15 @@ class Alg_WC_Cost_of_Goods_Orders {
*/
public $is_columns_sorting_exclude_empty_lines;

/**
* $avoid_empty_order_metadata_saving.
*
* @since 3.2.0
*
* @var null
*/
protected $avoid_empty_order_metadata_saving = null;

/**
* Constructor.
*
Expand Down Expand Up @@ -427,23 +436,44 @@ function add_hooks() {
/**
* avoid_empty_order_metadata_saving.
*
* @version 3.1.3
* @version 3.2.0
* @since 3.1.3
*
* @param WC_Abstract_Order $order
* @param $data_store
*
* @return void
* @return WC_Abstract_Order
*/
function avoid_empty_order_metadata_saving( WC_Abstract_Order $order, $data_store ) {
if ( 'yes' === get_option( 'alg_wc_cog_avoid_empty_order_metadata_saving', 'yes' ) ) {
if ( $this->need_to_avoid_empty_order_metadata_saving() ) {
/* @var $meta_data WC_Meta_Data */
foreach ( $order->get_meta_data() as $meta_data ) {
if ( empty( $meta_data->get_data()['value'] ) ) {
if (
substr( $meta_data->get_data()['key'], 0, 12 ) === "_alg_wc_cog_" &&
empty( $meta_data->get_data()['value'] )
) {
$order->delete_meta_data( $meta_data->get_data()['key'] );
}
}
}

return $order;
}

/**
* need_to_avoid_empty_order_metadata_saving.
*
* @version 3.2.0
* @since 3.2.0
*
* @return bool|null
*/
function need_to_avoid_empty_order_metadata_saving() {
if ( is_null( $this->avoid_empty_order_metadata_saving ) ) {
$this->avoid_empty_order_metadata_saving = 'yes' === get_option( 'alg_wc_cog_avoid_empty_order_metadata_saving', 'yes' );
}

return $this->avoid_empty_order_metadata_saving;
}

/**
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.1.9';
public $version = '3.2.0';

/**
* @since 1.0.0
Expand Down
32 changes: 16 additions & 16 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.1.9\n"
"Project-Id-Version: cost-of-goods-for-woocommerce 3.2.0\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-12-19T16:25:09+01:00\n"
"POT-Creation-Date: 2023-12-20T20:39:44+01: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 @@ -75,8 +75,8 @@ msgstr ""
#: 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:151
#: includes/class-alg-wc-cog-orders.php:701
#: includes/class-alg-wc-cog-orders.php:811
#: includes/class-alg-wc-cog-orders.php:731
#: includes/class-alg-wc-cog-orders.php:841
#: includes/class-alg-wc-cog-products-add-stock.php:351
#: includes/class-alg-wc-cog-products-add-stock.php:404
#: includes/class-alg-wc-cog-products.php:305
Expand All @@ -102,8 +102,8 @@ msgstr ""
#: 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:152
#: includes/class-alg-wc-cog-orders.php:702
#: includes/class-alg-wc-cog-orders.php:821
#: includes/class-alg-wc-cog-orders.php:732
#: includes/class-alg-wc-cog-orders.php:851
#: includes/class-alg-wc-cog-products.php:387
#: includes/pro/reports/class-wc-report-alg-cog-stock.php:123
#: includes/tools/class-alg-wc-cog-bulk-edit-tool.php:391
Expand Down Expand Up @@ -246,51 +246,51 @@ msgstr ""
msgid "fee"
msgstr ""

#: includes/class-alg-wc-cog-orders.php:313
#: includes/class-alg-wc-cog-orders.php:322
#: includes/settings/class-alg-wc-cog-settings-orders.php:180
msgid "You are selling below the cost of goods."
msgstr ""

#: includes/class-alg-wc-cog-orders.php:509
#: includes/class-alg-wc-cog-orders.php:539
#: includes/settings/class-alg-wc-cog-settings-orders.php:295
#: includes/settings/class-alg-wc-cog-settings-tools.php:360
msgid "Taxes to profit"
msgstr ""

#: includes/class-alg-wc-cog-orders.php:548
#: includes/class-alg-wc-cog-orders.php:578
#: includes/settings/class-alg-wc-cog-settings-orders.php:288
#: includes/settings/class-alg-wc-cog-settings-tools.php:359
msgid "Fees to profit"
msgstr ""

#: includes/class-alg-wc-cog-orders.php:588
#: includes/class-alg-wc-cog-orders.php:618
#: includes/settings/class-alg-wc-cog-settings-orders.php:274
#: includes/settings/class-alg-wc-cog-settings-tools.php:358
msgid "Shipping to profit"
msgstr ""

#: includes/class-alg-wc-cog-orders.php:590
#: includes/class-alg-wc-cog-orders.php:620
msgid "Shipping to profit (%s)"
msgstr ""

#: includes/class-alg-wc-cog-orders.php:705
#: includes/class-alg-wc-cog-orders.php:1160
#: includes/class-alg-wc-cog-orders.php:735
#: includes/class-alg-wc-cog-orders.php:1190
#: includes/pro/class-alg-wc-cog-pro.php:627
#: includes/pro/class-alg-wc-cog-pro.php:646
msgid "Cost of goods"
msgstr ""

#: includes/class-alg-wc-cog-orders.php:824
#: includes/class-alg-wc-cog-orders.php:854
#: includes/settings/class-alg-wc-cog-settings-orders.php:48
msgid "Profit percent"
msgstr ""

#: includes/class-alg-wc-cog-orders.php:827
#: includes/class-alg-wc-cog-orders.php:857
#: includes/settings/class-alg-wc-cog-settings-orders.php:48
msgid "Profit margin"
msgstr ""

#: includes/class-alg-wc-cog-orders.php:1196
#: includes/class-alg-wc-cog-orders.php:1226
msgid "Handling Fee"
msgstr ""

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, profit, profit calculator
Requires at least: 6.1
Tested up to: 6.4
Stable tag: 3.1.9
Stable tag: 3.2.0
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -365,6 +365,9 @@ Once activated, access the plugin's settings by navigating to “WooCommerce > S

== Changelog ==

= 3.2.0 - 20/12/2023 =
* Fix - Advanced - "Avoid empty order metadata from being saved to database" option might trigger errors on checkout.

= 3.1.9 - 19/12/2023 =
* Dev - Compatibility - Measurement Price Calculator - Add option to adjust the cost of goods sold according to the product measurement.
* Dev - Compatibility - Measurement Price Calculator - Create option to add the placeholder `%measurement_unit%` to the cost field label option.
Expand Down

0 comments on commit 58a5cd0

Please sign in to comment.