Skip to content

Commit

Permalink
v3.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Oct 24, 2024
1 parent 45f915d commit 4ccd293
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 9 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.5.4
Version: 3.5.5
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: cost-of-goods-for-woocommerce
Expand Down
6 changes: 4 additions & 2 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.5.0
* @version 3.5.5
* @since 2.1.0
* @author WPFactory
*/
Expand Down Expand Up @@ -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`)
Expand Down Expand Up @@ -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 ) ) {
Expand Down Expand Up @@ -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 ) {
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.5.4';
public $version = '3.5.5';

/**
* @since 1.0.0
Expand Down
12 changes: 10 additions & 2 deletions includes/settings/class-alg-wc-cog-settings-orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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)
Expand Down Expand Up @@ -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',
Expand Down
12 changes: 12 additions & 0 deletions langs/cost-of-goods-for-woocommerce-de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
12 changes: 12 additions & 0 deletions langs/cost-of-goods-for-woocommerce-tr_TR.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
12 changes: 12 additions & 0 deletions langs/cost-of-goods-for-woocommerce-zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
16 changes: 14 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.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 <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: 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"
Expand Down Expand Up @@ -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 ""
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.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

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4ccd293

Please sign in to comment.