From 4ccd293fa481c4fff24174493c29cd3820ee60e5 Mon Sep 17 00:00:00 2001 From: Pablo Pacheco Date: Thu, 24 Oct 2024 16:22:22 -0300 Subject: [PATCH] v3.5.5 --- cost-of-goods-for-woocommerce.php | 2 +- includes/class-alg-wc-cog-orders.php | 6 ++++-- includes/class-alg-wc-cog.php | 2 +- .../class-alg-wc-cog-settings-orders.php | 12 ++++++++++-- langs/cost-of-goods-for-woocommerce-de_DE.po | 12 ++++++++++++ langs/cost-of-goods-for-woocommerce-tr_TR.po | 12 ++++++++++++ langs/cost-of-goods-for-woocommerce-zh_CN.po | 12 ++++++++++++ langs/cost-of-goods-for-woocommerce.pot | 16 ++++++++++++++-- readme.txt | 5 ++++- 9 files changed, 70 insertions(+), 9 deletions(-) diff --git a/cost-of-goods-for-woocommerce.php b/cost-of-goods-for-woocommerce.php index cf26e44..cc96202 100644 --- a/cost-of-goods-for-woocommerce.php +++ b/cost-of-goods-for-woocommerce.php @@ -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.5.4 +Version: 3.5.5 Author: WPFactory Author URI: https://wpfactory.com Text Domain: cost-of-goods-for-woocommerce diff --git a/includes/class-alg-wc-cog-orders.php b/includes/class-alg-wc-cog-orders.php index c42141c..c5d6299 100644 --- a/includes/class-alg-wc-cog-orders.php +++ b/includes/class-alg-wc-cog-orders.php @@ -2,7 +2,7 @@ /** * Cost of Goods for WooCommerce - Orders Class. * - * @version 3.5.0 + * @version 3.5.5 * @since 2.1.0 * @author WPFactory */ @@ -1281,7 +1281,7 @@ function get_shipping_total_for_percentage_fees( $order ) { /** * update_order_items_costs. * - * @version 3.5.0 + * @version 3.5.5 * @since 1.1.0 * @todo [maybe] filters: add more? * @todo [maybe] `$total_price`: customizable calculation method (e.g. `$order->get_subtotal()`) (this will affect `_alg_wc_cog_order_profit_margin`) @@ -1358,6 +1358,7 @@ function update_order_items_costs( $args ) { $total_price = 0; $order_total_refunded = is_a( $order, 'WC_Order_Refund' ) ? $order->get_amount() : $order->get_total_refunded(); $order_total_refunded = (float) apply_filters( 'alg_wc_cog_order_total_refunded', $order_total_refunded, $order ); + $consider_extra_costs_from_meta_as_positive = 'yes' === get_option( 'alg_wc_cog_order_extra_cost_from_meta_as_positive', 'no' ); do_action( 'alg_wc_cog_before_update_order_items_costs', $order ); // Calculations if ( empty( $this->delay_calculations_status ) || $order->has_status( $this->delay_calculations_status ) ) { @@ -1621,6 +1622,7 @@ function update_order_items_costs( $args ) { array_shift( $meta_keys_splitted ); $fee = $this->get_array_value_by_dynamic_keys( $meta_keys_splitted, $post_meta_value ); } + $fee = $consider_extra_costs_from_meta_as_positive ? abs( $fee ) : $fee; $meta_fees += apply_filters( 'alg_wc_cog_order_extra_cost_from_meta', floatval( $fee ), $order ); } if ( 0 !== $meta_fees ) { diff --git a/includes/class-alg-wc-cog.php b/includes/class-alg-wc-cog.php index 43f1490..d1dcef7 100644 --- a/includes/class-alg-wc-cog.php +++ b/includes/class-alg-wc-cog.php @@ -35,7 +35,7 @@ final class Alg_WC_Cost_of_Goods { * @since 1.0.0 * @var string */ - public $version = '3.5.4'; + public $version = '3.5.5'; /** * @since 1.0.0 diff --git a/includes/settings/class-alg-wc-cog-settings-orders.php b/includes/settings/class-alg-wc-cog-settings-orders.php index 96e0945..e9b1495 100644 --- a/includes/settings/class-alg-wc-cog-settings-orders.php +++ b/includes/settings/class-alg-wc-cog-settings-orders.php @@ -2,7 +2,7 @@ /** * Cost of Goods for WooCommerce - Orders Section Settings. * - * @version 3.5.0 + * @version 3.5.5 * @since 1.7.0 * @author WPFactory */ @@ -28,7 +28,7 @@ function __construct() { /** * get_settings. * - * @version 3.5.0 + * @version 3.5.5 * @since 1.7.0 * @todo [later] `alg_wc_cog_order_prepopulate_in_ajax`: remove (i.e. always enabled) * @todo [later] `alg_wc_cog_order_save_items_ajax`: remove (i.e. always enabled) @@ -498,6 +498,14 @@ function get_settings() { 'type' => 'textarea', 'css' => 'height:100px;', ), + array( + 'title' => __( 'Sign handling', 'cost-of-goods-for-woocommerce' ), + 'desc' => __( 'Consider all values as positive', 'cost-of-goods-for-woocommerce' ), + 'desc_tip' => __( 'Negative numbers will be converted to positive', 'cost-of-goods-for-woocommerce' ) , + 'id' => 'alg_wc_cog_order_extra_cost_from_meta_as_positive', + 'default' => 'no', + 'type' => 'checkbox', + ), array( 'type' => 'sectionend', 'id' => 'alg_wc_cog_order_extra_cost_from_meta_options', diff --git a/langs/cost-of-goods-for-woocommerce-de_DE.po b/langs/cost-of-goods-for-woocommerce-de_DE.po index ed2121a..a2ee029 100644 --- a/langs/cost-of-goods-for-woocommerce-de_DE.po +++ b/langs/cost-of-goods-for-woocommerce-de_DE.po @@ -3136,3 +3136,15 @@ msgstr "" #: includes/class-alg-wc-cog.php:166 msgid "Cost of Goods Sold" msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:502 +msgid "Sign handling" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:503 +msgid "Consider all values as positive" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:504 +msgid "Negative numbers will be converted to positive" +msgstr "" diff --git a/langs/cost-of-goods-for-woocommerce-tr_TR.po b/langs/cost-of-goods-for-woocommerce-tr_TR.po index 41afd77..031784c 100644 --- a/langs/cost-of-goods-for-woocommerce-tr_TR.po +++ b/langs/cost-of-goods-for-woocommerce-tr_TR.po @@ -3172,3 +3172,15 @@ msgstr "" #: includes/class-alg-wc-cog.php:166 msgid "Cost of Goods Sold" msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:502 +msgid "Sign handling" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:503 +msgid "Consider all values as positive" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:504 +msgid "Negative numbers will be converted to positive" +msgstr "" diff --git a/langs/cost-of-goods-for-woocommerce-zh_CN.po b/langs/cost-of-goods-for-woocommerce-zh_CN.po index bf0f085..c72302d 100644 --- a/langs/cost-of-goods-for-woocommerce-zh_CN.po +++ b/langs/cost-of-goods-for-woocommerce-zh_CN.po @@ -3134,3 +3134,15 @@ msgstr "" #: includes/class-alg-wc-cog.php:166 msgid "Cost of Goods Sold" msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:502 +msgid "Sign handling" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:503 +msgid "Consider all values as positive" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:504 +msgid "Negative numbers will be converted to positive" +msgstr "" diff --git a/langs/cost-of-goods-for-woocommerce.pot b/langs/cost-of-goods-for-woocommerce.pot index 9c91de8..5cf8cde 100644 --- a/langs/cost-of-goods-for-woocommerce.pot +++ b/langs/cost-of-goods-for-woocommerce.pot @@ -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.5.4\n" +"Project-Id-Version: cost-of-goods-for-woocommerce 3.5.5\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cost-of-goods-for-woocommerce\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-10-14T16:37:56+02:00\n" +"POT-Creation-Date: 2024-10-24T21:21:46+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" @@ -1934,6 +1934,18 @@ msgstr "" msgid "One meta key per line." msgstr "" +#: includes/settings/class-alg-wc-cog-settings-orders.php:502 +msgid "Sign handling" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:503 +msgid "Consider all values as positive" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-orders.php:504 +msgid "Negative numbers will be converted to positive" +msgstr "" + #: includes/settings/class-alg-wc-cog-settings-products.php:39 msgid "General product options" msgstr "" diff --git a/readme.txt b/readme.txt index 618af90..3c4fbbb 100644 --- a/readme.txt +++ b/readme.txt @@ -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.6 -Stable tag: 3.5.4 +Stable tag: 3.5.5 License: GNU General Public License v3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -344,6 +344,9 @@ Once activated, access the plugin's settings by navigating to “WooCommerce > S == Changelog == += 3.5.5 - 24/10/2024 = +* Dev - Added new option to consider all extra costs from meta as positive. + = 3.5.4 - 14/10/2024 = * Dev - WPFactory admin menu removed from pro version. * Fix - WPFactory menu and submenus are now visible and accessible.