Showing with 48 additions and 29 deletions.
  1. +4 −0 CHANGELOG.md
  2. +6 −6 composer.lock
  3. +27 −19 inc/woocommerce.php
  4. +1 −1 package.json
  5. +8 −1 readme.txt
  6. +2 −2 woocommerce-product-addon.php
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
##### [Version 32.0.21](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.20...v32.0.21) (2024-05-16)

- Enhanced security

##### [Version 32.0.20](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.19...v32.0.20) (2024-04-30)

- Fixed File Input not working
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 27 additions & 19 deletions inc/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,25 @@ function ppom_check_validation( $product_id, $post_data, $passed = true ) {

$passed = apply_filters( 'ppom_before_fields_validation', $passed, $field, $post_data, $product_id );

if ( empty( $field['data_name'] ) || empty( $field['required'] )
&& ( empty( $field['min_checked'] ) && empty( $field['max_checked'] ) )
) {
if ( empty( $field['data_name'] ) ) {
continue;
}

$data_name = sanitize_key( $field['data_name'] );

if ( ! empty($ppom_posted_fields[$data_name]) && $ppom_posted_fields[$data_name] !== strip_tags( $ppom_posted_fields[$data_name] ) ) {
$passed = false;
}

if ( empty( $field['required'] ) && ( empty( $field['min_checked'] ) && empty( $field['max_checked'] ) )
) {
continue;
}


$title = isset( $field['title'] ) ? $field['title'] : '';
$type = isset( $field['type'] ) ? $field['type'] : '';


// var_dump($data_name, ppom_is_field_hidden_by_condition($data_name));
// Check if field is required by hidden by condition
if ( ppom_is_field_hidden_by_condition( $data_name ) ) {
Expand All @@ -257,7 +265,7 @@ function ppom_check_validation( $product_id, $post_data, $passed = true ) {
$error_message = stripslashes( $error_message );
ppom_wc_add_notice( $error_message );
$passed = false;
}
}
}

// ppom_pa($post_data); exit;
Expand Down Expand Up @@ -341,7 +349,7 @@ function ppom_woocommerce_update_cart_fees( $cart_items, $values ) {
if ( $option['apply'] == 'quantities' ) {
$ppom_total_quantities += $option['quantity'];
$ppom_item_order_qty = $ppom_total_quantities;
}
}
}
}

Expand Down Expand Up @@ -444,7 +452,7 @@ function ppom_woocommerce_update_cart_fees( $cart_items, $values ) {
$new_weight = $wc_product->get_weight() + $option_weight;
$wc_product->set_weight( $new_weight );
}
}
}
}
}

Expand Down Expand Up @@ -637,7 +645,7 @@ function ppom_woocommerce_add_item_meta( $item_meta, $cart_item ) {
}


// If no value
// If no value
if ( ! $display ) {
continue;
}
Expand Down Expand Up @@ -666,7 +674,7 @@ function ppom_woocommerce_add_item_meta( $item_meta, $cart_item ) {
'hidden' => $hidden,
'display' => $display,
);
}
}
}

return $item_meta;
Expand Down Expand Up @@ -712,7 +720,7 @@ function ppom_woocommerce_alter_price( $price, $product ) {

$options = $meta['options'];
$ranges = ppom_convert_options_to_key_val( $options, $meta, $product );
// ppom_pa($ranges);
// ppom_pa($ranges);

if ( isset( $meta['discount'] ) && $meta['discount'] == 'on' ) {

Expand Down Expand Up @@ -742,24 +750,24 @@ function ppom_woocommerce_alter_price( $price, $product ) {
}
}
}
}
}
}

return apply_filters( 'ppom_loop_matrix_price', $price, $from_pice, $to_price );
}

/*
function ppom_hide_variation_price_html($show, $parent, $variation) {
$product_id = $parent->get_id();
$ppom = new PPOM_Meta( $product_id );
if( $ppom->is_exists && $ppom->price_display != 'hide' ) {
$show = false;
}
return $show;
}*/

// Set default quantity for price matrix
Expand Down Expand Up @@ -1389,9 +1397,9 @@ function ppom_woocommerce_rename_files( $order_id, $posted_data, $order ) {
function ppom_wc_order_again_compatibility( $cart_item_data, $item, $order ) {
$ppom_data = $item->get_meta('_ppom_fields');

if( is_array($ppom_data) && array_key_exists( 'fields', $ppom_data ) ) {
$cart_item_data['ppom'] = $ppom_data;
}
if( is_array($ppom_data) && array_key_exists( 'fields', $ppom_data ) ) {
$cart_item_data['ppom'] = $ppom_data;
}

return $cart_item_data;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woocommerce-product-addon",
"version": "32.0.20",
"version": "32.0.21",
"description": "PPOM for WooCommerce",
"main": "index.js",
"repository": "https://github.com/Codeinwp/woocommerce-product-addon",
Expand Down
9 changes: 8 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: themeisle
Tags: woocommerce product addons, woocommerce product options, woocommerce product fields, woocommerce product, woocommerce product addon
Requires at least: 3.5
Tested up to: 6.5
Stable tag: 32.0.20
Stable tag: 32.0.21
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Requires PHP: 7.2
Expand Down Expand Up @@ -122,6 +122,13 @@ If you feels that PPOM Free or PPOM PRO versions are not enough for your needs,

== Changelog ==

##### [Version 32.0.21](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.20...v32.0.21) (2024-05-16)

- Enhanced security




##### [Version 32.0.20](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.19...v32.0.20) (2024-04-30)

- Fixed File Input not working
Expand Down
4 changes: 2 additions & 2 deletions woocommerce-product-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: PPOM for WooCommerce
* Plugin URI: https://themeisle.com/plugins/ppom-pro/
* Description: PPOM (Personalized Product Meta Manager) plugin allow WooCommerce Store Admin to create unlimited input fields and files to attach with Product Pages.
* Version: 32.0.20
* Version: 32.0.21
* Author: Themeisle
* Text Domain: woocommerce-product-addon
* Domain Path: /languages
Expand All @@ -26,7 +26,7 @@
define( 'PPOM_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'PPOM_WP_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __DIR__ ) ) );
define( 'PPOM_BASENAME', basename( PPOM_WP_PLUGIN_DIR ) );
define( 'PPOM_VERSION', '32.0.20' );
define( 'PPOM_VERSION', '32.0.21' );
define( 'PPOM_DB_VERSION', '30.1.0' );
define( 'PPOM_PRODUCT_META_KEY', '_product_meta_id' );
define( 'PPOM_TABLE_META', 'nm_personalized' );
Expand Down