Skip to content

Commit

Permalink
v3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Sep 24, 2024
1 parent 8a952e3 commit 4f5d14e
Show file tree
Hide file tree
Showing 10 changed files with 448 additions and 383 deletions.
15 changes: 15 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/.git
/.github
/node_modules
/.wordpress-org
.idea
.distignore
.eslintrc.js
.gitignore
Makefile
package.json
package-lock.json
readme.md
vendor/wpfactory/wpf-settings-exporter
vendor/wpfactory/wpf-documentor
git-tag.sh
7 changes: 6 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ includes/analytics/.eslintrc.js export-ignore
vendor/wpfactory/wpf-settings-exporter export-ignore
vendor/wpfactory/wpf-documentor export-ignore
# GIT - Release version
/git-tag.sh export-ignore
/git-tag.sh export-ignore
# Composer
composer.json
composer.lock export ignore
includes/pro/composer.lock export-ignore
includes/pro/composer.json
4 changes: 2 additions & 2 deletions cost-of-goods-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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: 3.4.9
Version: 3.5.0
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: cost-of-goods-for-woocommerce
Domain Path: /langs
Copyright: © 2024 WPFactory
WC tested up to: 9.2
WC tested up to: 9.3
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
Expand Down
7 changes: 4 additions & 3 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.4.8
* @version 3.5.0
* @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.4.8
* @version 3.5.0
* @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 @@ -1322,6 +1322,7 @@ function update_order_items_costs( $args ) {
$shipping_classes_term_ids_used = array();
$shipping_classes_fixed_cost_calculation = get_option( 'alg_wc_cog_shipping_classes_fixed_cost_calculation', 'per_product' );
}
$ignore_quantity = 'yes' === alg_wc_cog_get_option( 'alg_wc_cog_order_calculation_ignores_quantity', 'no' );
$shipping_class_cost_fixed_total = 0;
$shipping_class_cost_percent_total = 0;
$shipping_classes_cost_total = 0;
Expand Down Expand Up @@ -1419,7 +1420,7 @@ function update_order_items_costs( $args ) {
'dots_and_commas_operation' => 'comma-to-dot'
) );
$cost = (float) $cost;
$line_cost = $cost * $quantity;
$line_cost = $ignore_quantity ? $cost : $cost * $quantity;
$item_line_total = $item['line_total'];
if ( $ignore_item_refund_amount ) {
$item_line_total -= $order->get_total_refunded_for_item( $item_id );
Expand Down
11 changes: 9 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.4.8
* @version 3.5.0
* @since 1.7.0
* @author WPFactory
*/
Expand All @@ -28,7 +28,7 @@ function __construct() {
/**
* get_settings.
*
* @version 3.4.8
* @version 3.5.0
* @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 @@ -251,6 +251,13 @@ function get_settings() {
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Ignore quantity', 'cost-of-goods-for-woocommerce' ),
'desc' => __( 'Ignore quantity sold when calculating profit and costs', 'cost-of-goods-for-woocommerce' ),
'id' => 'alg_wc_cog_order_calculation_ignores_quantity',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Order total', 'cost-of-goods-for-woocommerce' ),
'desc' => __( 'The way taxes will be considered when calculating order total on percentage costs.', 'cost-of-goods-for-woocommerce' ),
Expand Down
Loading

0 comments on commit 4f5d14e

Please sign in to comment.