Skip to content

Commit

Permalink
v3.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Dec 13, 2023
1 parent 2820e06 commit 3f93ab0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 38 deletions.
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.1.7
Version: 3.1.8
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: cost-of-goods-for-woocommerce
Domain Path: /langs
Copyright: © 2023 WPFactory
WC tested up to: 8.3
WC tested up to: 8.4
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
Expand Down
39 changes: 19 additions & 20 deletions includes/class-alg-wc-cog-products-add-stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Cost of Goods for WooCommerce - Products - Add Stock.
*
* @version 3.1.7
* @version 3.1.8
* @since 2.8.2
* @author WPFactory
*/
Expand All @@ -25,12 +25,12 @@ class Alg_WC_Cost_of_Goods_Products_Add_Stock {
/**
* Constructor.
*
* @version 3.1.7
* @version 3.1.8
* @since 2.8.2
*/
function __construct() {
// Add product stock
add_action( 'add_meta_boxes', array( $this, 'add_product_add_stock_meta_box' ) );
add_action( 'add_meta_boxes', array( $this, 'add_product_add_stock_meta_box' ), 10, 2 );
add_action( 'save_post_product', array( $this, 'save_product_add_stock' ), PHP_INT_MAX, 2 );
add_action( 'admin_head', array( $this, 'create_add_stock_style' ) );
add_action( 'wp_ajax_get_add_stock_history_table', array( $this, 'get_add_stock_history_table_ajax' ) );
Expand All @@ -54,28 +54,27 @@ function is_add_stock_enabled() {
/**
* add_product_add_stock_meta_box.
*
* @version 3.1.7
* @version 3.1.8
* @since 1.7.0
*/
function add_product_add_stock_meta_box() {
function add_product_add_stock_meta_box( $post_type, $post ) {
if ( ! apply_filters( 'alg_wc_cog_create_product_meta_box_validation', true ) ) {
return;
}
if ( $this->is_add_stock_enabled() ) {
if (
( $product = wc_get_product( get_the_ID() ) ) &&
$product->is_type( 'simple' ) || $product->is_type( 'variable' )
) {
$tip = wc_help_tip( __( 'Enter values and "Update" the product.', 'cost-of-goods-for-woocommerce' ) . ' ' .
__( '"Stock" will be added to your inventory, and "Cost" will be used to calculate new average cost of goods for the product.', 'cost-of-goods-for-woocommerce' ) );
add_meta_box( 'alg-wc-cog-add-stock',
//__( 'Cost of Goods', 'cost-of-goods-for-woocommerce' ) . ': ' . __( 'Add stock', 'cost-of-goods-for-woocommerce' ) . $tip,
__( 'Add stock', 'cost-of-goods-for-woocommerce' ) . $tip,
array( $this, 'product_add_stock_meta_box' ),
'product',
'side'
);
}
if (
$post &&
is_a( $product = wc_get_product( $post->ID ), 'WC_Product' ) &&
$this->is_add_stock_enabled() &&
( $product->is_type( 'simple' ) || $product->is_type( 'variable' ) )
) {
$tip = wc_help_tip( __( 'Enter values and "Update" the product.', 'cost-of-goods-for-woocommerce' ) . ' ' .
__( '"Stock" will be added to your inventory, and "Cost" will be used to calculate new average cost of goods for the product.', 'cost-of-goods-for-woocommerce' ) );
add_meta_box( 'alg-wc-cog-add-stock',
__( 'Add stock', 'cost-of-goods-for-woocommerce' ) . $tip,
array( $this, 'product_add_stock_meta_box' ),
'product',
'side'
);
}
}

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.7';
public $version = '3.1.8';

/**
* @since 1.0.0
Expand Down
28 changes: 14 additions & 14 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.7\n"
"Project-Id-Version: cost-of-goods-for-woocommerce 3.1.8\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-13T04:17:51+01:00\n"
"POT-Creation-Date: 2023-12-13T13:29:25+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 @@ -77,8 +77,8 @@ msgstr ""
#: 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-products-add-stock.php:352
#: includes/class-alg-wc-cog-products-add-stock.php:405
#: 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
#: includes/class-alg-wc-cog-products.php:316
#: includes/class-alg-wc-cog-products.php:327
Expand Down Expand Up @@ -293,11 +293,11 @@ msgstr ""
msgid "Handling Fee"
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:69
#: includes/class-alg-wc-cog-products-add-stock.php:70
msgid "Enter values and \"Update\" the product."
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:70
#: includes/class-alg-wc-cog-products-add-stock.php:71
#: includes/settings/class-alg-wc-cog-settings-products.php:240
msgid "\"Stock\" will be added to your inventory, and \"Cost\" will be used to calculate new average cost of goods for the product."
msgstr ""
Expand All @@ -310,38 +310,38 @@ msgstr ""
msgid "Add stock"
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:348
#: includes/class-alg-wc-cog-products-add-stock.php:404
#: includes/class-alg-wc-cog-products-add-stock.php:347
#: includes/class-alg-wc-cog-products-add-stock.php:403
#: includes/pro/class-alg-wc-cog-pro.php:812
#: includes/pro/reports/class-wc-report-alg-cog-stock.php:120
#: includes/settings/class-alg-wc-cog-settings-tools.php:133
#: includes/tools/class-alg-wc-cog-wplist-bulk-edit-tool.php:369
msgid "Stock"
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:369
#: includes/class-alg-wc-cog-products-add-stock.php:368
msgid "History"
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:403
#: includes/class-alg-wc-cog-products-add-stock.php:402
#: includes/settings/class-alg-wc-cog-settings-products.php:204
msgid "Date"
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:444
#: includes/class-alg-wc-cog-products-add-stock.php:443
msgid "Variation history"
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:451
#: includes/class-alg-wc-cog-products-add-stock.php:450
#: includes/class-alg-wc-cog-products-cost-archive.php:295
msgid "Select variation"
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:530
#: includes/class-alg-wc-cog-products-add-stock.php:529
msgid "If no variation is selected, the parent product will be updated."
msgstr ""

#: includes/class-alg-wc-cog-products-add-stock.php:531
#: includes/class-alg-wc-cog-products-add-stock.php:530
msgid "Update variation(s)"
msgstr ""

Expand Down
6 changes: 5 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.7
Stable tag: 3.1.8
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,10 @@ Once activated, access the plugin's settings by navigating to “WooCommerce > S

== Changelog ==

= 3.1.8 - 13/12/2023 =
* Fix - Uncaught Error: Call to a member function is_type() on bool in `Alg_WC_Cost_of_Goods_Products_Add_Stock`.
* WC tested up to: 8.4.

= 3.1.7 - 13/12/2023 =
* Fix - Cost archive - Cost data is updated even when previous and current values are the same.
* Fix - It's possible to use the "Add stock" feature even with the product "Stock management" disabled.
Expand Down

0 comments on commit 3f93ab0

Please sign in to comment.