Plugin Directory

Changeset 3759367


Ignore:
Timestamp:
10/22/2026 06:01:08 AM (5 weeks ago)
Author:
themeisle
Message:

Update to version 34.0.12 from GitHub

Location:
woocommerce-product-addon
Files:
36 edited
1 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-product-addon/tags/34.0.12/CHANGELOG.md

    r3733313 r3759367  
     1##### [Version 34.0.12](https://github.com/Codeinwp/woocommerce-product-addon/compare/v34.0.11...v34.0.12) (2026-10-22)
     2
     3- Fixed the PPOM price summary showing the product price in the wrong currency
     4- Fixed cart option prices showing unconverted in secondary WCML currencies.
     5- Fixed identical linked-quantity products merging into one cart line
     6- Updated dependencies
     7
    18##### [Version 34.0.11](https://github.com/Codeinwp/woocommerce-product-addon/compare/v34.0.10...v34.0.11) (2026-10-07)
    29
  • woocommerce-product-addon/tags/34.0.12/classes/frontend-scripts.class.php

    r3733313 r3759367  
    300300
    301301                        $product = wc_get_product( $product_id );
     302                        if ( ! $product instanceof WC_Product ) {
     303                                return '';
     304                        }
    302305
    303306                        $ppom = new PPOM_Meta( $product_id );
    … …  
    577580                                $input_js_vars['field_meta']               = $inputs_meta_updated;
    578581                                $input_js_vars['wc_no_decimal']            = $decimal_palces;
    579                                 $input_js_vars['wc_product_price']         = ppom_get_product_price( $product, '', 'product' );
     582                                $input_js_vars['wc_product_price']         = \PPOM\Support\Helpers::get_product_display_price( $product );
    580583                                $input_js_vars['wc_product_regular_price'] = ppom_get_product_regular_price( $product );
    581584                                $input_js_vars['product_title']            = $product->get_title();
  • woocommerce-product-addon/tags/34.0.12/classes/plugin.class.php

    r3733313 r3759367  
    920920
    921921        /**
    922          * Register the core ppom_option_price conversion hook only when PPOM Pro
    923          * has not already registered ppom_hooks_convert_price on the same filter.
     922         * Register the core ppom_option_price conversion hook and the WCML cart row
     923         * pass only when PPOM Pro has not already registered ppom_hooks_convert_price
     924         * on the same filter. Running Pro registers both conversions itself.
    924925         *
    925926         * Called from __construct() on woocommerce_init — after every plugin has
    … …  
    933934                if ( ! has_filter( 'ppom_option_price', 'ppom_hooks_convert_price' ) ) {
    934935                        add_filter( 'ppom_option_price', array( $this, 'ppom_convert_price' ), 99, 1 );
    935                 }
     936                        add_filter( 'ppom_fields_prices', array( $this, 'convert_cart_rows_wcml' ), 10, 1 );
     937                }
     938        }
     939
     940        /**
     941         * Convert cart charge rows to the WCML client currency.
     942         *
     943         * WCML converts the product price when its meta is read, not the cart line,
     944         * so option rows must be converted to match the base. One-time fees are
     945         * converted when the fee is added, and percent rows are already a share of
     946         * the converted base.
     947         *
     948         * @param array<int, array<string, mixed>> $field_prices Charge rows from Engine::get_field_prices().
     949         * @return array<int, array<string, mixed>>
     950         */
     951        public function convert_cart_rows_wcml( $field_prices ) {
     952                foreach ( $field_prices as $index => $row ) {
     953                        if ( ! isset( $row['price'] ) || 'cart_fee' === ( $row['apply'] ?? '' ) || ! empty( $row['is_percent'] ) ) {
     954                                continue;
     955                        }
     956                        $field_prices[ $index ]['price'] = \PPOM\Support\Helpers::convert_to_wcml_line_currency( $row['price'] );
     957                }
     958
     959                return $field_prices;
    936960        }
    937961
  • woocommerce-product-addon/tags/34.0.12/readme.txt

    r3733313 r3759367  
    44Requires at least: 6.2
    55Tested up to: 7.1
    6 Stable tag: 34.0.11
     6Stable tag: 34.0.12
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    … …  
    260260== Changelog ==
    261261
    262 ##### [Version 34.0.11](https://github.com/Codeinwp/woocommerce-product-addon/compare/v34.0.10...v34.0.11) (2026-10-07)
    263 
    264 - Fixed SVG uploads failing in File upload fields
    265 - Fixed the first product-page price to use the visible conditional price matrix.
    266 - Fixed conditional fields to respond only to selections in their own product form.
    267 - Fixed modern pricing to honor zero-price matrix selections
    268 - Fixed the file picker for upload fields with hyphenated names.
    269 - Fixed PPOM applying currency exchange rates twice to priced options and cart totals.
    270 - Fixed PPOM Pro converting WPML cart option charges twice.
    271 - Fixed currency switchers converting PPOM option prices more than once.
    272 - Fixed file uploads allowing visitors to delete files outside uploads folder.
     262##### [Version 34.0.12](https://github.com/Codeinwp/woocommerce-product-addon/compare/v34.0.11...v34.0.12) (2026-10-22)
     263
     264- Fixed the PPOM price summary showing the product price in the wrong currency
     265- Fixed cart option prices showing unconverted in secondary WCML currencies.
     266- Fixed identical linked-quantity products merging into one cart line
    273267- Updated dependencies
    274268
  • woocommerce-product-addon/tags/34.0.12/src/Arrays/Settings.php

    r3733313 r3759367  
    644644                $js_vars['wc_decimal_sep']            = get_option( 'woocommerce_price_decimal_sep' );
    645645                $js_vars['wc_no_decimal']             = $decimal_palces;
    646                 $variation_id                         = '';
    647                 $context                              = 'product';
    648                 $js_vars['wc_product_price']          = Helpers::get_product_price( $product, $variation_id, $context );
     646                $js_vars['wc_product_price']          = Helpers::get_product_display_price( $product );
    649647                $js_vars['wc_product_regular_price']  = Helpers::get_product_regular_price( $product );
    650648                $ppom_label_discount_price            = Helpers::get_option( 'ppom_label_discount_price', __( 'Discount Price', 'woocommerce-product-addon' ) );
  • woocommerce-product-addon/tags/34.0.12/src/Pricing/Engine.php

    r3733313 r3759367  
    2020 */
    2121final class Engine {
     22
     23        /**
     24         * Field types whose options can be priced as a percentage of the product price.
     25         *
     26         * @var list<'select'|'radio'|'checkbox'|'multiple_select'|'cropper'|'palettes'|'imageselect'|'image'|'audio'>
     27         */
     28        private const PERCENT_PRICED_FIELD_TYPES = array( 'select', 'radio', 'checkbox', 'multiple_select', 'cropper', 'palettes', 'imageselect', 'image', 'audio' );
    2229
    2330        /**
    … …  
    296303         * @param array<string, mixed>|null $item             Cart item context.
    297304         *
    298          * @return array<string, mixed>
     305         * @return array<int, array<string, mixed>>
    299306         *
    300307         * @see Helpers::get_field_meta_by_dataname()
    … …  
    968975                $without_tax  = isset( $option['without_tax'] ) ? $option['without_tax'] : '';
    969976
    970                 // Charge rows stay in store currency: the switcher converts the cart line on read
    971                 // and Pro's WPML pass converts these rows itself. Only the label is display (#755).
     977                // Charge rows stay in store currency: switchers convert the cart line on read, and
     978                // the WCML pass on ppom_fields_prices converts the rows. Only the label is converted here.
    972979                $label_price = "{$field_title} - " . wc_price( apply_filters( 'ppom_option_price', $field_price ) );
    973980                // For bulkquantity
    … …  
    9951002                                'quantity'     => $qty,
    9961003                                'base_price'   => $base_price,
     1004                                'is_percent'   => self::is_percent_option_price( $option, $field_type ),
    9971005                        ),
    9981006                        $field_meta,
    … …  
    10031011        }
    10041012
     1013        /**
     1014         * Whether a charge row's price is a percentage of the product price, using
     1015         * the checkbox discount over the option price as get_field_prices() does.
     1016         * Percentage detection is restricted to the listed saved-option field types.
     1017         *
     1018         * @param array<string, mixed>|string $option     Option the row was priced from.
     1019         * @param string                      $field_type Saved field type.
     1020         * @return bool
     1021         */
     1022        private static function is_percent_option_price( $option, string $field_type ): bool {
     1023                if ( ! in_array( $field_type, self::PERCENT_PRICED_FIELD_TYPES, true ) || ! is_array( $option ) ) {
     1024                        return false;
     1025                }
     1026                $raw_price = isset( $option['raw_discount'] ) && $option['raw_discount'] > 0 ? $option['raw_discount'] : ( $option['raw_price'] ?? '' );
     1027
     1028                return false !== strpos( (string) $raw_price, '%' );
     1029        }
     1030
    10051031        // Get total addon price of given Price Array
    10061032        public static function price_get_addon_total( $price_array ) {
    … …  
    10471073                                }
    10481074                        }
     1075                }
     1076
     1077                return $total_cart_fee;
     1078        }
     1079
     1080        /**
     1081         * Total of the one-time fees in the currency the cart line is shown in. Flat fee
     1082         * rows are store currency; percentage fees are already a share of the shown price.
     1083         *
     1084         * @param array<int, array<string, mixed>> $price_array Charge rows from get_field_prices().
     1085         * @return float
     1086         */
     1087        public static function price_get_client_cart_fee_total( array $price_array ): float {
     1088                $total_cart_fee = 0.0;
     1089
     1090                foreach ( $price_array as $price ) {
     1091                        if ( 'cart_fee' !== $price['apply'] ) {
     1092                                continue;
     1093                        }
     1094                        $fee_price       = self::normalize_price_value( $price['price'] );
     1095                        $total_cart_fee += empty( $price['is_percent'] ) ? (float) apply_filters( 'ppom_option_price', $fee_price ) : $fee_price;
    10491096                }
    10501097
    … …  
    15191566                                $price_tobe_discount = Helpers::get_product_price( $native_product ) * $quantity;
    15201567                                if ( $matrix_found['discount'] == 'both' ) {
    1521                                         $total_addon_price    = self::price_get_addon_total( $ppom_field_prices );
    1522                                         $total_cart_fee_price = self::price_get_cart_fee_total( $ppom_field_prices );
    1523                                         // Fee rows are store currency; the line price is what WooCommerce shows, so convert the fees once (#755).
    1524                                         $price_tobe_discount  = ( $cart_item_price * $quantity ) + apply_filters( 'ppom_option_price', $total_cart_fee_price );
     1568                                        $price_tobe_discount = ( $cart_item_price * $quantity ) + self::price_get_client_cart_fee_total( $ppom_field_prices );
    15251569                                }
    15261570
    … …  
    15561600                                $label        = $fee['label'];
    15571601                                $option_label = isset( $fee['option_label'] ) ? $fee['option_label'] : '';
    1558                                 $fee_price    = Helpers::convert_fee_price( $fee['price'] );
     1602                                // A percentage fee is already a share of the converted product price.
     1603                                $fee_price    = empty( $fee['is_percent'] ) ? Helpers::convert_fee_price( $fee['price'] ) : $fee['price'];
    15591604                                $taxable      = $fee['taxable']; // deprecated soon
    15601605
  • woocommerce-product-addon/tags/34.0.12/src/Pricing/ModernCartFeeApplicator.php

    r3733313 r3759367  
    4242                                $price_tobe_discount = ppom_get_product_price( $native_product ) * $quantity;
    4343                                if ( $matrix_found['discount'] == 'both' ) {
    44                                         $total_addon_price    = ppom_price_get_addon_total( $ppom_field_prices );
    45                                         $total_cart_fee_price = ppom_price_get_cart_fee_total( $ppom_field_prices );
    46                                         // Fee rows are store currency; the line price is what WooCommerce shows, so convert the fees once (#755).
    47                                         $price_tobe_discount  = ( $cart_item_price * $quantity ) + apply_filters( 'ppom_option_price', $total_cart_fee_price );
     44                                        $price_tobe_discount = ( $cart_item_price * $quantity ) + Engine::price_get_client_cart_fee_total( $ppom_field_prices );
    4845                                }
    4946
    … …  
    6764                                $label        = $fee['label'];
    6865                                $option_label = isset( $fee['option_label'] ) ? $fee['option_label'] : '';
    69                                 $fee_price    = \PPOM\Support\Helpers::convert_fee_price( $fee['price'] );
     66                                // A percentage fee is already a share of the converted product price.
     67                                $fee_price    = empty( $fee['is_percent'] ) ? \PPOM\Support\Helpers::convert_fee_price( $fee['price'] ) : $fee['price'];
    7068                                $taxable      = $fee['taxable'];
    7169
  • woocommerce-product-addon/tags/34.0.12/src/Support/Helpers.php

    r3733313 r3759367  
    182182
    183183                return apply_filters( 'ppom_product_price', $product_price, $product );
     184        }
     185
     186        /**
     187         * Product price for the browser price summary, in the shopper's currency.
     188         *
     189         * CURCY's PPOM integration reverts ppom_product_price to store currency for
     190         * server-side pricing, so it is converted back here for display only.
     191         *
     192         * @param \WC_Product $product Product.
     193         * @return mixed Whatever ppom_product_price returns, converted under CURCY.
     194         */
     195        public static function get_product_display_price( \WC_Product $product ) {
     196                $product_price = self::get_product_price( $product, '', 'product' );
     197
     198                if ( self::curcy_integration_active() && function_exists( 'wmc_get_price' ) ) {
     199                        return wmc_get_price( $product_price );
     200                }
     201
     202                return $product_price;
    184203        }
    185204
    … …  
    14201439
    14211440        /**
     1441         * Whether WCML converts product prices in this request. On admin-ajax actions
     1442         * outside its allowlist it leaves them in store currency.
     1443         *
     1444         * @return bool
     1445         */
     1446        public static function wcml_converts_product_prices(): bool {
     1447                global $woocommerce_wpml;
     1448
     1449                $multi_currency = $woocommerce_wpml->multi_currency ?? null;
     1450
     1451                return is_object( $multi_currency )
     1452                        && method_exists( $multi_currency, 'are_filters_need_loading' )
     1453                        && $multi_currency->are_filters_need_loading();
     1454        }
     1455
     1456        /**
     1457         * Converts a store-currency amount to the currency WCML prices the cart line in.
     1458         * Other switchers convert the line when it is read, so the amount stays as is.
     1459         *
     1460         * @param mixed $price Amount in store currency.
     1461         * @return mixed
     1462         */
     1463        public static function convert_to_wcml_line_currency( $price ) {
     1464                if ( ! is_numeric( $price ) || ! self::wcml_converts_product_prices() ) {
     1465                        return $price;
     1466                }
     1467
     1468                return apply_filters( 'wcml_raw_price_amount', (float) $price );
     1469        }
     1470
     1471        /**
     1472         * Store-currency amount of a price WCML converted for this request.
     1473         *
     1474         * @param mixed $price Amount in the WCML client currency.
     1475         * @return mixed
     1476         */
     1477        public static function wcml_store_currency_price( $price ) {
     1478                global $woocommerce_wpml;
     1479
     1480                $prices = $woocommerce_wpml->multi_currency->prices ?? null;
     1481
     1482                if ( ! is_numeric( $price ) || ! is_object( $prices ) || ! method_exists( $prices, 'unconvert_price_amount' ) || ! self::wcml_converts_product_prices() ) {
     1483                        return $price;
     1484                }
     1485
     1486                return $prices->unconvert_price_amount( (float) $price );
     1487        }
     1488
     1489        /**
    14221490         * Whether CURCY's own PPOM integration is loaded. It hooks ppom_option_price and
    14231491         * ppom_cart_fixed_fee itself, so PPOM's CURCY conversion must step aside (#755).
    … …  
    20252093
    20262094        /**
     2095         * Option price for the legacy cart line: a flat price in the currency the line is
     2096         * priced in, or a percentage of the product price, which already is in it.
     2097         *
     2098         * @param array<mixed>|string    $field_meta   Field settings, as get_field_meta_by_dataname() returns them.
     2099         * @param mixed                  $option_label Selected option label.
     2100         * @param \WC_Product|false|null $product      Product of the cart line, as wc_get_product() returns it.
     2101         * @return mixed
     2102         */
     2103        private static function get_field_option_line_price( $field_meta, $option_label, $product ) {
     2104                $stored_price = (string) self::get_field_option_stored_price( $field_meta, $option_label );
     2105
     2106                if ( false === strpos( $stored_price, '%' ) ) {
     2107                        return self::convert_to_wcml_line_currency( self::get_field_option_raw_price( $field_meta, $option_label ) );
     2108                }
     2109
     2110                $amount = $product instanceof \WC_Product ? Engine::get_amount_after_percentage( $product->get_price(), $stored_price ) : 0;
     2111
     2112                return apply_filters( 'ppom_field_option_price', wc_format_decimal( $amount ), $field_meta, $option_label );
     2113        }
     2114
     2115        /**
    20272116         * Option price exactly as saved in the field settings.
    20282117         *
    … …  
    20492138        }
    20502139
    2051         // Getting field option price by ID
    2052         public static function get_field_option_price_by_id( $option, $product, $ppom_meta_ids ) {
     2140        /**
     2141         * Getting field option price by ID.
     2142         *
     2143         * @param array<string, mixed>  $option           Cart payload row with data_name and option_id.
     2144         * @param \WC_Product           $product          Product of the cart line; percentage prices need it.
     2145         * @param string|int|array<int> $ppom_meta_ids    PPOM field group ids.
     2146         * @param bool                  $in_line_currency Return a flat price in the currency the cart line is priced in.
     2147         * @return mixed
     2148         */
     2149        public static function get_field_option_price_by_id( $option, $product, $ppom_meta_ids, bool $in_line_currency = false ) {
    20532150
    20542151                $data_name = isset( $option['data_name'] ) ? $option['data_name'] : '';
    … …  
    20782175                }
    20792176
    2080                 $option_price = 0;
     2177                $saved_price = '';
    20812178
    20822179                switch ( $field_type ) {
    … …  
    20882185                                                $image_id = $field_meta['data_name'] . '-' . $option['id'];
    20892186                                                if ( $image_id == $option_id && isset( $option['price'] ) && $option['price'] != '' ) {
    2090 
    2091                                                         if ( strpos( $option['price'], '%' ) !== false ) {
    2092                                                                 $option_price = Engine::get_amount_after_percentage( $product->get_price(), $option['price'] );
    2093                                                         } else {
    2094                                                                 // For currency switcher
    2095                                                                 // $option_price = apply_filters('ppom_option_price', $option['price']);
    2096                                                                 $option_price = $option['price'];
    2097                                                         }
     2187                                                        $saved_price = (string) $option['price'];
    20982188                                                }
    20992189                                        }
    … …  
    21062196
    21072197                                                if ( $option['id'] == $option_id && isset( $option['price'] ) && $option['price'] != '' ) {
    2108 
    2109                                                         if ( strpos( $option['price'], '%' ) !== false ) {
    2110                                                                 $option_price = Engine::get_amount_after_percentage( $product->get_price(), $option['price'] );
    2111                                                         } else {
    2112                                                                 // For currency switcher
    2113                                                                 // $option_price = apply_filters('ppom_option_price', $option['price']);
    2114                                                                 $option_price = $option['price'];
    2115                                                         }
     2198                                                        $saved_price = (string) $option['price'];
    21162199                                                }
    21172200                                        }
    … …  
    21202203                }
    21212204
     2205                $option_price = self::saved_option_amount( $saved_price, $product, $in_line_currency );
    21222206
    21232207                return apply_filters( 'ppom_field_option_price_by_id', wc_format_decimal( $option_price ), $field_meta, $option_id, $product );
     2208        }
     2209
     2210        /**
     2211         * Amount of a saved option price: a percentage of the product price, or the flat price.
     2212         *
     2213         * @param string      $saved_price      Saved option price, empty when no option matched.
     2214         * @param \WC_Product $product          Product of the cart line.
     2215         * @param bool        $in_line_currency Convert a flat price to the currency the cart line is priced in.
     2216         * @return mixed
     2217         */
     2218        private static function saved_option_amount( string $saved_price, $product, bool $in_line_currency ) {
     2219                if ( '' === $saved_price ) {
     2220                        return 0;
     2221                }
     2222
     2223                if ( false !== strpos( $saved_price, '%' ) ) {
     2224                        return Engine::get_amount_after_percentage( $product->get_price(), $saved_price );
     2225                }
     2226
     2227                return $in_line_currency ? self::convert_to_wcml_line_currency( $saved_price ) : $saved_price;
    21242228        }
    21252229
    … …  
    24482552         * Builds a legacy ppom_option_price structure from posted field values.
    24492553         *
    2450          * @param array<string, mixed> $fields_posted Posted ppom[fields] payload.
    2451          * @param int                  $product_id    Product ID to look up field metadata against.
     2554         * @param array<string, mixed>   $fields_posted Posted ppom[fields] payload.
     2555         * @param int                    $product_id    Product ID to look up field metadata against.
     2556         * @param \WC_Product|false|null $line_product  Product the cart line is priced from, such as the
     2557         *                                              selected variation; percentages are taken of its price.
    24522558         *
    24532559         * @return array<array<string, mixed>> Option-price entries (empty when no priced options match).
    24542560         */
    2455         public static function compute_option_price_from_fields( $fields_posted, $product_id ) {
     2561        public static function compute_option_price_from_fields( $fields_posted, $product_id, $line_product = null ) {
    24562562
    24572563                $option_prices = array();
    24582564                $ppom_id       = isset( $fields_posted['id'] ) ? $fields_posted['id'] : null;
     2565                $product       = $line_product instanceof \WC_Product ? $line_product : wc_get_product( $product_id );
    24592566
    24602567                foreach ( $fields_posted as $data_name => $value ) {
    … …  
    24692576                        if ( is_array( $value ) ) {
    24702577                                foreach ( $value as $cb_value ) {
    2471                                         $price = self::get_field_option_raw_price( $field_meta, $cb_value );
     2578                                        $price = self::get_field_option_line_price( $field_meta, $cb_value, $product );
    24722579                                        if ( 0 != $price ) {
    24732580                                                $option_prices[] = array(
    … …  
    24792586                                }
    24802587                        } else {
    2481                                 $price = self::get_field_option_raw_price( $field_meta, $value );
     2588                                $price = self::get_field_option_line_price( $field_meta, $value, $product );
    24822589                                if ( 0 != $price ) {
    24832590                                        $option_prices[] = array(
  • woocommerce-product-addon/tags/34.0.12/src/WooCommerce/Cart/CartHandler.php

    r3733313 r3759367  
    2121 */
    2222final class CartHandler {
     23
     24        /**
     25         * Cart item key that keeps each add of a quantity-controlling product on its own line.
     26         *
     27         * WooCommerce merges identical adds by summing their quantities, while those
     28         * fields fix the line quantity themselves.
     29         */
     30        private const LINE_KEY = 'ppom_line_key';
    2331
    2432        /**
    … …  
    374382                $cart[ Handler::VERIFIED_FILES_KEY ] = Handler::payload_file_names( $cart['ppom'] );
    375383
    376                 return $cart;
     384                return self::separate_quantity_controlled_line( $cart, (int) $product_id );
     385        }
     386
     387        /**
     388         * Gives the cart item of a quantity-controlling product its own line.
     389         *
     390         * Sold-individually products keep the shared cart id, which is how
     391         * WooCommerce rejects a second add.
     392         *
     393         * @param array<string, mixed> $cart_item_data Cart item data.
     394         * @param int                  $product_id     Parent product ID.
     395         *
     396         * @return array<string, mixed>
     397         */
     398        public static function separate_quantity_controlled_line( array $cart_item_data, int $product_id ): array {
     399                if ( Helpers::is_cart_quantity_updatable( $product_id ) ) {
     400                        return $cart_item_data;
     401                }
     402
     403                $product = wc_get_product( $product_id );
     404                if ( $product && $product->is_sold_individually() ) {
     405                        return $cart_item_data;
     406                }
     407
     408                $cart_item_data[ self::LINE_KEY ] = wp_generate_uuid4();
     409
     410                return $cart_item_data;
    377411        }
    378412
    … …  
    444478
    445479                if ( empty( $values['ppom']['ppom_option_price'] ) && ! empty( $values['ppom']['fields'] ) ) {
    446                         $computed = Helpers::compute_option_price_from_fields( $values['ppom']['fields'], $product_id );
     480                        $computed = Helpers::compute_option_price_from_fields( $values['ppom']['fields'], $product_id, $wc_product );
    447481                        if ( ! empty( $computed ) ) {
    448482                                $values['ppom']['ppom_option_price'] = wp_json_encode( $computed );
    … …  
    513547                                        $resolved_line_price = isset( $option['price'] ) ? $option['price'] : 0;
    514548                                        if ( isset( $option['data_name'] ) && isset( $option['option_id'] ) ) {
    515                                                 $resolved_line_price = Helpers::get_field_option_price_by_id( $option, $wc_product, $ppom_meta_ids );
     549                                                $resolved_line_price = Helpers::get_field_option_price_by_id( $option, $wc_product, $ppom_meta_ids, true );
    516550                                        }
    517551                                }
    … …  
    10881122         * Turns a saved amount into the figure the cart shows.
    10891123         *
    1090          * Percentages resolve against the product base price. The amount stays net, because
     1124         * Percentages resolve against the store-currency product base price, so callers
     1125         * convert flat and percentage amounts the same way. The amount stays net, because
    10911126         * the tax display transformation belongs to the display path alone.
    10921127         *
    … …  
    11041139
    11051140                if ( false !== strpos( $amount, '%' ) ) {
    1106                         $base   = Callbacks::convert_price_back( Helpers::get_product_price( $product, null, 'cart' ) );
     1141                        $base   = Helpers::wcml_store_currency_price( Callbacks::convert_price_back( Helpers::get_product_price( $product, null, 'cart' ) ) );
    11071142                        $amount = Engine::get_amount_after_percentage( $base, $amount );
    11081143                }
  • woocommerce-product-addon/tags/34.0.12/src/WooCommerce/Order/OrderHandler.php

    r3733313 r3759367  
    1313use PPOM\Files\Handler;
    1414use PPOM\Support\Helpers;
     15use PPOM\WooCommerce\Cart\CartHandler;
    1516
    1617/**
    … …  
    341342         * @param  \WC_Order_Item_Product $item Order Item Product
    342343         * @param  \WC_Order              $order
    343          * @return void
     344         * @return array<string, mixed>
    344345         */
    345346        public static function wc_order_again_compatibility( $cart_item_data, $item, $order ) {
    … …  
    349350                        self::restore_order_files_to_upload_dir( $ppom_data['fields'], $item, $order );
    350351                        $cart_item_data['ppom'] = $ppom_data;
     352                        $cart_item_data         = CartHandler::separate_quantity_controlled_line( $cart_item_data, (int) $item->get_product_id() );
    351353                }
    352354
  • woocommerce-product-addon/tags/34.0.12/src/WooCommerce/Product/ProductHandler.php

    r3733313 r3759367  
    237237                                }
    238238
    239                                 $computed = Helpers::compute_option_price_from_fields( $fields, $product_id );
     239                                $computed = Helpers::compute_option_price_from_fields( $fields, $product_id, wc_get_product( $variation_id ? $variation_id : $product_id ) );
    240240                                if ( ! empty( $computed ) ) {
    241241                                        $_POST['ppom']['ppom_option_price'] = wp_json_encode( $computed );
  • woocommerce-product-addon/tags/34.0.12/vendor/codeinwp/themeisle-sdk/load.php

    r3733313 r3759367  
    1515}
    1616// Current SDK version and path.
    17 $themeisle_sdk_version = '3.3.66';
     17$themeisle_sdk_version = '3.3.67';
    1818$themeisle_sdk_path    = dirname( __FILE__ );
    1919
  • woocommerce-product-addon/tags/34.0.12/vendor/codeinwp/themeisle-sdk/src/Loader.php

    r3720596 r3759367  
    391391                        'connect_cursor'   => 'Add to Cursor',
    392392                        'hint_off'         => 'Your agents can connect once Easy MCP is active.',
    393                         'hint_on'          => 'Each button opens your agent with this site pre-filled. ChatGPT asks you to paste the URL above.',
     393                        'hint_on'          => 'Each button opens your agent with this site pre-filled. In ChatGPT, click Add, then Add custom MCP server, and paste the URL above.',
    394394                        'more_agents'      => 'Using another agent?',
    395395                        'more_agents_link' => 'See how to connect it.',
  • woocommerce-product-addon/tags/34.0.12/vendor/codeinwp/themeisle-sdk/src/Modules/Ai_connect.php

    r3720596 r3759367  
    740740         * One-click deep links. They mirror Easy MCP's own
    741741         * Admin_Page::build_connect_url() so they can be offered before it runs.
    742          * ChatGPT cannot be pre-filled: the user pastes the URL. Cursor's link wants
     742         * ChatGPT has no link to its form: its link opens the Plugins page, where
     743         * the user adds the server and pastes the URL. Cursor's link wants
    743744         * its `config` as Base64 JSON; the script appends it (window.btoa), because
    744745         * PHP's Base64 function is refused by the WordPress.org plugin check in
    … …  
    756757                return array(
    757758                        'claude'  => 'https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=' . rawurlencode( $name ) . '&connectorUrl=' . rawurlencode( $endpoint ),
    758                         'chatgpt' => 'https://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2Fplugins',
     759                        'chatgpt' => 'https://chatgpt.com/plugins',
    759760                        'cursor'  => 'cursor://anysphere.cursor-deeplink/mcp/install?name=' . rawurlencode( $name ),
    760761                );
  • woocommerce-product-addon/tags/34.0.12/vendor/codeinwp/themeisle-sdk/src/Modules/Crash_reporter.php

    r3630454 r3759367  
    188188
    189189        /**
    190          * Global handler for uncaught exceptions. Captures the crash and chains to
    191          * the previously registered handler, if any.
     190         * Global handler for uncaught exceptions. Captures the crash, then hands
     191         * the exception on: to the previously registered handler when there is
     192         * one, otherwise back to PHP.
     193         *
     194         * A handler that returns makes PHP end the request as if nothing failed:
     195         * no fatal error is raised or logged and error_get_last() stays empty, so
     196         * WordPress never shows its "critical error" page, never enters recovery
     197         * mode and does not roll back a broken automatic update. Rethrowing keeps
     198         * the request failing exactly as it would without this handler.
    192199         *
    193200         * @param \Throwable $throwable Uncaught exception.
     201         *
     202         * @throws \Throwable The same exception, when no earlier handler exists.
    194203         */
    195204        public static function handle_exception( $throwable ) {
    … …  
    205214                if ( null !== self::$previous_exception_handler && is_callable( self::$previous_exception_handler ) ) {
    206215                        call_user_func( self::$previous_exception_handler, $throwable );
    207                 }
     216
     217                        return;
     218                }
     219
     220                throw $throwable;
    208221        }
    209222
    … …  
    211224         * Shutdown handler. Records supported fatal errors originating from a
    212225         * registered product directory. Never outputs and never exits.
    213          */
    214         public static function handle_shutdown() {
     226         *
     227         * @param array{type: int, message: string, file: string, line: int}|null $error Error to examine. Defaults to
     228         *                                                                             error_get_last(); tests pass a synthetic one.
     229         */
     230        public static function handle_shutdown( $error = null ) {
    215231                self::$reserved_memory = null;
    216232
    217                 $error = error_get_last();
     233                if ( null === $error ) {
     234                        $error = error_get_last();
     235                }
    218236                if ( empty( $error ) || ! isset( $error['type'] ) || ! in_array( (int) $error['type'], self::$fatal_types, true ) ) {
    219237                        return;
  • woocommerce-product-addon/tags/34.0.12/vendor/composer/installed.json

    r3733313 r3759367  
    33        {
    44            "name": "codeinwp/themeisle-sdk",
    5             "version": "3.3.66",
    6             "version_normalized": "3.3.66.0",
     5            "version": "3.3.67",
     6            "version_normalized": "3.3.67.0",
    77            "source": {
    88                "type": "git",
    99                "url": "https://github.com/Codeinwp/themeisle-sdk.git",
    10                 "reference": "27e095d8357e0594cd5769222af1258538832e75"
     10                "reference": "e1dda44811660a65c3da6994349c054a46686d69"
    1111            },
    1212            "dist": {
    1313                "type": "zip",
    14                 "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/27e095d8357e0594cd5769222af1258538832e75",
    15                 "reference": "27e095d8357e0594cd5769222af1258538832e75",
     14                "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/e1dda44811660a65c3da6994349c054a46686d69",
     15                "reference": "e1dda44811660a65c3da6994349c054a46686d69",
    1616                "shasum": ""
    1717            },
    … …  
    2020                "yoast/phpunit-polyfills": "^4.0"
    2121            },
    22             "time": "2026-10-07T08:46:25+00:00",
     22            "time": "2026-10-13T12:16:34+00:00",
    2323            "type": "library",
    2424            "installation-source": "dist",
    … …  
    4141            "support": {
    4242                "issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
    43                 "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.66"
     43                "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.67"
    4444            },
    4545            "install-path": "../codeinwp/themeisle-sdk"
  • woocommerce-product-addon/tags/34.0.12/vendor/composer/installed.php

    r3733313 r3759367  
    22    'root' => array(
    33        'name' => 'codeinwp/woocommerce-product-addon',
    4         'pretty_version' => 'v34.0.11',
    5         'version' => '34.0.11.0',
    6         'reference' => '5a5807826d5a5c57941963932f12cbd28558e302',
     4        'pretty_version' => 'v34.0.12',
     5        'version' => '34.0.12.0',
     6        'reference' => '5e981bd06d3e86b4a43699e473dc049d989f3d6c',
    77        'type' => 'project',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1212    'versions' => array(
    1313        'codeinwp/themeisle-sdk' => array(
    14             'pretty_version' => '3.3.66',
    15             'version' => '3.3.66.0',
    16             'reference' => '27e095d8357e0594cd5769222af1258538832e75',
     14            'pretty_version' => '3.3.67',
     15            'version' => '3.3.67.0',
     16            'reference' => 'e1dda44811660a65c3da6994349c054a46686d69',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
    … …  
    2121        ),
    2222        'codeinwp/woocommerce-product-addon' => array(
    23             'pretty_version' => 'v34.0.11',
    24             'version' => '34.0.11.0',
    25             'reference' => '5a5807826d5a5c57941963932f12cbd28558e302',
     23            'pretty_version' => 'v34.0.12',
     24            'version' => '34.0.12.0',
     25            'reference' => '5e981bd06d3e86b4a43699e473dc049d989f3d6c',
    2626            'type' => 'project',
    2727            'install_path' => __DIR__ . '/../../',
  • woocommerce-product-addon/tags/34.0.12/woocommerce-product-addon.php

    r3733313 r3759367  
    44 * Plugin URI: https://themeisle.com/plugins/ppom-pro/
    55 * Description: PPOM (Personalized Product Option Manager) plugin allow WooCommerce Store Admin to create unlimited input fields and files to attach with Product Pages.
    6  * Version: 34.0.11
     6 * Version: 34.0.12
    77 * Author: Themeisle
    88 * Text Domain: woocommerce-product-addon
    … …  
    3333define( 'PPOM_BASENAME', basename( PPOM_WP_PLUGIN_DIR ) );
    3434define( 'PPOM_PRODUCT_SLUG', PPOM_BASENAME );
    35 define( 'PPOM_VERSION', '34.0.11' );
     35define( 'PPOM_VERSION', '34.0.12' );
    3636define( 'PPOM_DB_VERSION', '32.1.0' );
    3737define( 'PPOM_PRODUCT_META_KEY', '_product_meta_id' );
  • woocommerce-product-addon/trunk/CHANGELOG.md

    r3733313 r3759367  
     1##### [Version 34.0.12](https://github.com/Codeinwp/woocommerce-product-addon/compare/v34.0.11...v34.0.12) (2026-10-22)
     2
     3- Fixed the PPOM price summary showing the product price in the wrong currency
     4- Fixed cart option prices showing unconverted in secondary WCML currencies.
     5- Fixed identical linked-quantity products merging into one cart line
     6- Updated dependencies
     7
    18##### [Version 34.0.11](https://github.com/Codeinwp/woocommerce-product-addon/compare/v34.0.10...v34.0.11) (2026-10-07)
    29
  • woocommerce-product-addon/trunk/classes/frontend-scripts.class.php

    r3733313 r3759367  
    300300
    301301                        $product = wc_get_product( $product_id );
     302                        if ( ! $product instanceof WC_Product ) {
     303                                return '';
     304                        }
    302305
    303306                        $ppom = new PPOM_Meta( $product_id );
    … …  
    577580                                $input_js_vars['field_meta']               = $inputs_meta_updated;
    578581                                $input_js_vars['wc_no_decimal']            = $decimal_palces;
    579                                 $input_js_vars['wc_product_price']         = ppom_get_product_price( $product, '', 'product' );
     582                                $input_js_vars['wc_product_price']         = \PPOM\Support\Helpers::get_product_display_price( $product );
    580583                                $input_js_vars['wc_product_regular_price'] = ppom_get_product_regular_price( $product );
    581584                                $input_js_vars['product_title']            = $product->get_title();
  • woocommerce-product-addon/trunk/classes/plugin.class.php

    r3733313 r3759367  
    920920
    921921        /**
    922          * Register the core ppom_option_price conversion hook only when PPOM Pro
    923          * has not already registered ppom_hooks_convert_price on the same filter.
     922         * Register the core ppom_option_price conversion hook and the WCML cart row
     923         * pass only when PPOM Pro has not already registered ppom_hooks_convert_price
     924         * on the same filter. Running Pro registers both conversions itself.
    924925         *
    925926         * Called from __construct() on woocommerce_init — after every plugin has
    … …  
    933934                if ( ! has_filter( 'ppom_option_price', 'ppom_hooks_convert_price' ) ) {
    934935                        add_filter( 'ppom_option_price', array( $this, 'ppom_convert_price' ), 99, 1 );
    935                 }
     936                        add_filter( 'ppom_fields_prices', array( $this, 'convert_cart_rows_wcml' ), 10, 1 );
     937                }
     938        }
     939
     940        /**
     941         * Convert cart charge rows to the WCML client currency.
     942         *
     943         * WCML converts the product price when its meta is read, not the cart line,
     944         * so option rows must be converted to match the base. One-time fees are
     945         * converted when the fee is added, and percent rows are already a share of
     946         * the converted base.
     947         *
     948         * @param array<int, array<string, mixed>> $field_prices Charge rows from Engine::get_field_prices().
     949         * @return array<int, array<string, mixed>>
     950         */
     951        public function convert_cart_rows_wcml( $field_prices ) {
     952                foreach ( $field_prices as $index => $row ) {
     953                        if ( ! isset( $row['price'] ) || 'cart_fee' === ( $row['apply'] ?? '' ) || ! empty( $row['is_percent'] ) ) {
     954                                continue;
     955                        }
     956                        $field_prices[ $index ]['price'] = \PPOM\Support\Helpers::convert_to_wcml_line_currency( $row['price'] );
     957                }
     958
     959                return $field_prices;
    936960        }
    937961
  • woocommerce-product-addon/trunk/readme.txt

    r3733313 r3759367  
    44Requires at least: 6.2
    55Tested up to: 7.1
    6 Stable tag: 34.0.11
     6Stable tag: 34.0.12
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    … …  
    260260== Changelog ==
    261261
    262 ##### [Version 34.0.11](https://github.com/Codeinwp/woocommerce-product-addon/compare/v34.0.10...v34.0.11) (2026-10-07)
    263 
    264 - Fixed SVG uploads failing in File upload fields
    265 - Fixed the first product-page price to use the visible conditional price matrix.
    266 - Fixed conditional fields to respond only to selections in their own product form.
    267 - Fixed modern pricing to honor zero-price matrix selections
    268 - Fixed the file picker for upload fields with hyphenated names.
    269 - Fixed PPOM applying currency exchange rates twice to priced options and cart totals.
    270 - Fixed PPOM Pro converting WPML cart option charges twice.
    271 - Fixed currency switchers converting PPOM option prices more than once.
    272 - Fixed file uploads allowing visitors to delete files outside uploads folder.
     262##### [Version 34.0.12](https://github.com/Codeinwp/woocommerce-product-addon/compare/v34.0.11...v34.0.12) (2026-10-22)
     263
     264- Fixed the PPOM price summary showing the product price in the wrong currency
     265- Fixed cart option prices showing unconverted in secondary WCML currencies.
     266- Fixed identical linked-quantity products merging into one cart line
    273267- Updated dependencies
    274268
  • woocommerce-product-addon/trunk/src/Arrays/Settings.php

    r3733313 r3759367  
    644644                $js_vars['wc_decimal_sep']            = get_option( 'woocommerce_price_decimal_sep' );
    645645                $js_vars['wc_no_decimal']             = $decimal_palces;
    646                 $variation_id                         = '';
    647                 $context                              = 'product';
    648                 $js_vars['wc_product_price']          = Helpers::get_product_price( $product, $variation_id, $context );
     646                $js_vars['wc_product_price']          = Helpers::get_product_display_price( $product );
    649647                $js_vars['wc_product_regular_price']  = Helpers::get_product_regular_price( $product );
    650648                $ppom_label_discount_price            = Helpers::get_option( 'ppom_label_discount_price', __( 'Discount Price', 'woocommerce-product-addon' ) );
  • woocommerce-product-addon/trunk/src/Pricing/Engine.php

    r3733313 r3759367  
    2020 */
    2121final class Engine {
     22
     23        /**
     24         * Field types whose options can be priced as a percentage of the product price.
     25         *
     26         * @var list<'select'|'radio'|'checkbox'|'multiple_select'|'cropper'|'palettes'|'imageselect'|'image'|'audio'>
     27         */
     28        private const PERCENT_PRICED_FIELD_TYPES = array( 'select', 'radio', 'checkbox', 'multiple_select', 'cropper', 'palettes', 'imageselect', 'image', 'audio' );
    2229
    2330        /**
    … …  
    296303         * @param array<string, mixed>|null $item             Cart item context.
    297304         *
    298          * @return array<string, mixed>
     305         * @return array<int, array<string, mixed>>
    299306         *
    300307         * @see Helpers::get_field_meta_by_dataname()
    … …  
    968975                $without_tax  = isset( $option['without_tax'] ) ? $option['without_tax'] : '';
    969976
    970                 // Charge rows stay in store currency: the switcher converts the cart line on read
    971                 // and Pro's WPML pass converts these rows itself. Only the label is display (#755).
     977                // Charge rows stay in store currency: switchers convert the cart line on read, and
     978                // the WCML pass on ppom_fields_prices converts the rows. Only the label is converted here.
    972979                $label_price = "{$field_title} - " . wc_price( apply_filters( 'ppom_option_price', $field_price ) );
    973980                // For bulkquantity
    … …  
    9951002                                'quantity'     => $qty,
    9961003                                'base_price'   => $base_price,
     1004                                'is_percent'   => self::is_percent_option_price( $option, $field_type ),
    9971005                        ),
    9981006                        $field_meta,
    … …  
    10031011        }
    10041012
     1013        /**
     1014         * Whether a charge row's price is a percentage of the product price, using
     1015         * the checkbox discount over the option price as get_field_prices() does.
     1016         * Percentage detection is restricted to the listed saved-option field types.
     1017         *
     1018         * @param array<string, mixed>|string $option     Option the row was priced from.
     1019         * @param string                      $field_type Saved field type.
     1020         * @return bool
     1021         */
     1022        private static function is_percent_option_price( $option, string $field_type ): bool {
     1023                if ( ! in_array( $field_type, self::PERCENT_PRICED_FIELD_TYPES, true ) || ! is_array( $option ) ) {
     1024                        return false;
     1025                }
     1026                $raw_price = isset( $option['raw_discount'] ) && $option['raw_discount'] > 0 ? $option['raw_discount'] : ( $option['raw_price'] ?? '' );
     1027
     1028                return false !== strpos( (string) $raw_price, '%' );
     1029        }
     1030
    10051031        // Get total addon price of given Price Array
    10061032        public static function price_get_addon_total( $price_array ) {
    … …  
    10471073                                }
    10481074                        }
     1075                }
     1076
     1077                return $total_cart_fee;
     1078        }
     1079
     1080        /**
     1081         * Total of the one-time fees in the currency the cart line is shown in. Flat fee
     1082         * rows are store currency; percentage fees are already a share of the shown price.
     1083         *
     1084         * @param array<int, array<string, mixed>> $price_array Charge rows from get_field_prices().
     1085         * @return float
     1086         */
     1087        public static function price_get_client_cart_fee_total( array $price_array ): float {
     1088                $total_cart_fee = 0.0;
     1089
     1090                foreach ( $price_array as $price ) {
     1091                        if ( 'cart_fee' !== $price['apply'] ) {
     1092                                continue;
     1093                        }
     1094                        $fee_price       = self::normalize_price_value( $price['price'] );
     1095                        $total_cart_fee += empty( $price['is_percent'] ) ? (float) apply_filters( 'ppom_option_price', $fee_price ) : $fee_price;
    10491096                }
    10501097
    … …  
    15191566                                $price_tobe_discount = Helpers::get_product_price( $native_product ) * $quantity;
    15201567                                if ( $matrix_found['discount'] == 'both' ) {
    1521                                         $total_addon_price    = self::price_get_addon_total( $ppom_field_prices );
    1522                                         $total_cart_fee_price = self::price_get_cart_fee_total( $ppom_field_prices );
    1523                                         // Fee rows are store currency; the line price is what WooCommerce shows, so convert the fees once (#755).
    1524                                         $price_tobe_discount  = ( $cart_item_price * $quantity ) + apply_filters( 'ppom_option_price', $total_cart_fee_price );
     1568                                        $price_tobe_discount = ( $cart_item_price * $quantity ) + self::price_get_client_cart_fee_total( $ppom_field_prices );
    15251569                                }
    15261570
    … …  
    15561600                                $label        = $fee['label'];
    15571601                                $option_label = isset( $fee['option_label'] ) ? $fee['option_label'] : '';
    1558                                 $fee_price    = Helpers::convert_fee_price( $fee['price'] );
     1602                                // A percentage fee is already a share of the converted product price.
     1603                                $fee_price    = empty( $fee['is_percent'] ) ? Helpers::convert_fee_price( $fee['price'] ) : $fee['price'];
    15591604                                $taxable      = $fee['taxable']; // deprecated soon
    15601605
  • woocommerce-product-addon/trunk/src/Pricing/ModernCartFeeApplicator.php

    r3733313 r3759367  
    4242                                $price_tobe_discount = ppom_get_product_price( $native_product ) * $quantity;
    4343                                if ( $matrix_found['discount'] == 'both' ) {
    44                                         $total_addon_price    = ppom_price_get_addon_total( $ppom_field_prices );
    45                                         $total_cart_fee_price = ppom_price_get_cart_fee_total( $ppom_field_prices );
    46                                         // Fee rows are store currency; the line price is what WooCommerce shows, so convert the fees once (#755).
    47                                         $price_tobe_discount  = ( $cart_item_price * $quantity ) + apply_filters( 'ppom_option_price', $total_cart_fee_price );
     44                                        $price_tobe_discount = ( $cart_item_price * $quantity ) + Engine::price_get_client_cart_fee_total( $ppom_field_prices );
    4845                                }
    4946
    … …  
    6764                                $label        = $fee['label'];
    6865                                $option_label = isset( $fee['option_label'] ) ? $fee['option_label'] : '';
    69                                 $fee_price    = \PPOM\Support\Helpers::convert_fee_price( $fee['price'] );
     66                                // A percentage fee is already a share of the converted product price.
     67                                $fee_price    = empty( $fee['is_percent'] ) ? \PPOM\Support\Helpers::convert_fee_price( $fee['price'] ) : $fee['price'];
    7068                                $taxable      = $fee['taxable'];
    7169
  • woocommerce-product-addon/trunk/src/Support/Helpers.php

    r3733313 r3759367  
    182182
    183183                return apply_filters( 'ppom_product_price', $product_price, $product );
     184        }
     185
     186        /**
     187         * Product price for the browser price summary, in the shopper's currency.
     188         *
     189         * CURCY's PPOM integration reverts ppom_product_price to store currency for
     190         * server-side pricing, so it is converted back here for display only.
     191         *
     192         * @param \WC_Product $product Product.
     193         * @return mixed Whatever ppom_product_price returns, converted under CURCY.
     194         */
     195        public static function get_product_display_price( \WC_Product $product ) {
     196                $product_price = self::get_product_price( $product, '', 'product' );
     197
     198                if ( self::curcy_integration_active() && function_exists( 'wmc_get_price' ) ) {
     199                        return wmc_get_price( $product_price );
     200                }
     201
     202                return $product_price;
    184203        }
    185204
    … …  
    14201439
    14211440        /**
     1441         * Whether WCML converts product prices in this request. On admin-ajax actions
     1442         * outside its allowlist it leaves them in store currency.
     1443         *
     1444         * @return bool
     1445         */
     1446        public static function wcml_converts_product_prices(): bool {
     1447                global $woocommerce_wpml;
     1448
     1449                $multi_currency = $woocommerce_wpml->multi_currency ?? null;
     1450
     1451                return is_object( $multi_currency )
     1452                        && method_exists( $multi_currency, 'are_filters_need_loading' )
     1453                        && $multi_currency->are_filters_need_loading();
     1454        }
     1455
     1456        /**
     1457         * Converts a store-currency amount to the currency WCML prices the cart line in.
     1458         * Other switchers convert the line when it is read, so the amount stays as is.
     1459         *
     1460         * @param mixed $price Amount in store currency.
     1461         * @return mixed
     1462         */
     1463        public static function convert_to_wcml_line_currency( $price ) {
     1464                if ( ! is_numeric( $price ) || ! self::wcml_converts_product_prices() ) {
     1465                        return $price;
     1466                }
     1467
     1468                return apply_filters( 'wcml_raw_price_amount', (float) $price );
     1469        }
     1470
     1471        /**
     1472         * Store-currency amount of a price WCML converted for this request.
     1473         *
     1474         * @param mixed $price Amount in the WCML client currency.
     1475         * @return mixed
     1476         */
     1477        public static function wcml_store_currency_price( $price ) {
     1478                global $woocommerce_wpml;
     1479
     1480                $prices = $woocommerce_wpml->multi_currency->prices ?? null;
     1481
     1482                if ( ! is_numeric( $price ) || ! is_object( $prices ) || ! method_exists( $prices, 'unconvert_price_amount' ) || ! self::wcml_converts_product_prices() ) {
     1483                        return $price;
     1484                }
     1485
     1486                return $prices->unconvert_price_amount( (float) $price );
     1487        }
     1488
     1489        /**
    14221490         * Whether CURCY's own PPOM integration is loaded. It hooks ppom_option_price and
    14231491         * ppom_cart_fixed_fee itself, so PPOM's CURCY conversion must step aside (#755).
    … …  
    20252093
    20262094        /**
     2095         * Option price for the legacy cart line: a flat price in the currency the line is
     2096         * priced in, or a percentage of the product price, which already is in it.
     2097         *
     2098         * @param array<mixed>|string    $field_meta   Field settings, as get_field_meta_by_dataname() returns them.
     2099         * @param mixed                  $option_label Selected option label.
     2100         * @param \WC_Product|false|null $product      Product of the cart line, as wc_get_product() returns it.
     2101         * @return mixed
     2102         */
     2103        private static function get_field_option_line_price( $field_meta, $option_label, $product ) {
     2104                $stored_price = (string) self::get_field_option_stored_price( $field_meta, $option_label );
     2105
     2106                if ( false === strpos( $stored_price, '%' ) ) {
     2107                        return self::convert_to_wcml_line_currency( self::get_field_option_raw_price( $field_meta, $option_label ) );
     2108                }
     2109
     2110                $amount = $product instanceof \WC_Product ? Engine::get_amount_after_percentage( $product->get_price(), $stored_price ) : 0;
     2111
     2112                return apply_filters( 'ppom_field_option_price', wc_format_decimal( $amount ), $field_meta, $option_label );
     2113        }
     2114
     2115        /**
    20272116         * Option price exactly as saved in the field settings.
    20282117         *
    … …  
    20492138        }
    20502139
    2051         // Getting field option price by ID
    2052         public static function get_field_option_price_by_id( $option, $product, $ppom_meta_ids ) {
     2140        /**
     2141         * Getting field option price by ID.
     2142         *
     2143         * @param array<string, mixed>  $option           Cart payload row with data_name and option_id.
     2144         * @param \WC_Product           $product          Product of the cart line; percentage prices need it.
     2145         * @param string|int|array<int> $ppom_meta_ids    PPOM field group ids.
     2146         * @param bool                  $in_line_currency Return a flat price in the currency the cart line is priced in.
     2147         * @return mixed
     2148         */
     2149        public static function get_field_option_price_by_id( $option, $product, $ppom_meta_ids, bool $in_line_currency = false ) {
    20532150
    20542151                $data_name = isset( $option['data_name'] ) ? $option['data_name'] : '';
    … …  
    20782175                }
    20792176
    2080                 $option_price = 0;
     2177                $saved_price = '';
    20812178
    20822179                switch ( $field_type ) {
    … …  
    20882185                                                $image_id = $field_meta['data_name'] . '-' . $option['id'];
    20892186                                                if ( $image_id == $option_id && isset( $option['price'] ) && $option['price'] != '' ) {
    2090 
    2091                                                         if ( strpos( $option['price'], '%' ) !== false ) {
    2092                                                                 $option_price = Engine::get_amount_after_percentage( $product->get_price(), $option['price'] );
    2093                                                         } else {
    2094                                                                 // For currency switcher
    2095                                                                 // $option_price = apply_filters('ppom_option_price', $option['price']);
    2096                                                                 $option_price = $option['price'];
    2097                                                         }
     2187                                                        $saved_price = (string) $option['price'];
    20982188                                                }
    20992189                                        }
    … …  
    21062196
    21072197                                                if ( $option['id'] == $option_id && isset( $option['price'] ) && $option['price'] != '' ) {
    2108 
    2109                                                         if ( strpos( $option['price'], '%' ) !== false ) {
    2110                                                                 $option_price = Engine::get_amount_after_percentage( $product->get_price(), $option['price'] );
    2111                                                         } else {
    2112                                                                 // For currency switcher
    2113                                                                 // $option_price = apply_filters('ppom_option_price', $option['price']);
    2114                                                                 $option_price = $option['price'];
    2115                                                         }
     2198                                                        $saved_price = (string) $option['price'];
    21162199                                                }
    21172200                                        }
    … …  
    21202203                }
    21212204
     2205                $option_price = self::saved_option_amount( $saved_price, $product, $in_line_currency );
    21222206
    21232207                return apply_filters( 'ppom_field_option_price_by_id', wc_format_decimal( $option_price ), $field_meta, $option_id, $product );
     2208        }
     2209
     2210        /**
     2211         * Amount of a saved option price: a percentage of the product price, or the flat price.
     2212         *
     2213         * @param string      $saved_price      Saved option price, empty when no option matched.
     2214         * @param \WC_Product $product          Product of the cart line.
     2215         * @param bool        $in_line_currency Convert a flat price to the currency the cart line is priced in.
     2216         * @return mixed
     2217         */
     2218        private static function saved_option_amount( string $saved_price, $product, bool $in_line_currency ) {
     2219                if ( '' === $saved_price ) {
     2220                        return 0;
     2221                }
     2222
     2223                if ( false !== strpos( $saved_price, '%' ) ) {
     2224                        return Engine::get_amount_after_percentage( $product->get_price(), $saved_price );
     2225                }
     2226
     2227                return $in_line_currency ? self::convert_to_wcml_line_currency( $saved_price ) : $saved_price;
    21242228        }
    21252229
    … …  
    24482552         * Builds a legacy ppom_option_price structure from posted field values.
    24492553         *
    2450          * @param array<string, mixed> $fields_posted Posted ppom[fields] payload.
    2451          * @param int                  $product_id    Product ID to look up field metadata against.
     2554         * @param array<string, mixed>   $fields_posted Posted ppom[fields] payload.
     2555         * @param int                    $product_id    Product ID to look up field metadata against.
     2556         * @param \WC_Product|false|null $line_product  Product the cart line is priced from, such as the
     2557         *                                              selected variation; percentages are taken of its price.
    24522558         *
    24532559         * @return array<array<string, mixed>> Option-price entries (empty when no priced options match).
    24542560         */
    2455         public static function compute_option_price_from_fields( $fields_posted, $product_id ) {
     2561        public static function compute_option_price_from_fields( $fields_posted, $product_id, $line_product = null ) {
    24562562
    24572563                $option_prices = array();
    24582564                $ppom_id       = isset( $fields_posted['id'] ) ? $fields_posted['id'] : null;
     2565                $product       = $line_product instanceof \WC_Product ? $line_product : wc_get_product( $product_id );
    24592566
    24602567                foreach ( $fields_posted as $data_name => $value ) {
    … …  
    24692576                        if ( is_array( $value ) ) {
    24702577                                foreach ( $value as $cb_value ) {
    2471                                         $price = self::get_field_option_raw_price( $field_meta, $cb_value );
     2578                                        $price = self::get_field_option_line_price( $field_meta, $cb_value, $product );
    24722579                                        if ( 0 != $price ) {
    24732580                                                $option_prices[] = array(
    … …  
    24792586                                }
    24802587                        } else {
    2481                                 $price = self::get_field_option_raw_price( $field_meta, $value );
     2588                                $price = self::get_field_option_line_price( $field_meta, $value, $product );
    24822589                                if ( 0 != $price ) {
    24832590                                        $option_prices[] = array(
  • woocommerce-product-addon/trunk/src/WooCommerce/Cart/CartHandler.php

    r3733313 r3759367  
    2121 */
    2222final class CartHandler {
     23
     24        /**
     25         * Cart item key that keeps each add of a quantity-controlling product on its own line.
     26         *
     27         * WooCommerce merges identical adds by summing their quantities, while those
     28         * fields fix the line quantity themselves.
     29         */
     30        private const LINE_KEY = 'ppom_line_key';
    2331
    2432        /**
    … …  
    374382                $cart[ Handler::VERIFIED_FILES_KEY ] = Handler::payload_file_names( $cart['ppom'] );
    375383
    376                 return $cart;
     384                return self::separate_quantity_controlled_line( $cart, (int) $product_id );
     385        }
     386
     387        /**
     388         * Gives the cart item of a quantity-controlling product its own line.
     389         *
     390         * Sold-individually products keep the shared cart id, which is how
     391         * WooCommerce rejects a second add.
     392         *
     393         * @param array<string, mixed> $cart_item_data Cart item data.
     394         * @param int                  $product_id     Parent product ID.
     395         *
     396         * @return array<string, mixed>
     397         */
     398        public static function separate_quantity_controlled_line( array $cart_item_data, int $product_id ): array {
     399                if ( Helpers::is_cart_quantity_updatable( $product_id ) ) {
     400                        return $cart_item_data;
     401                }
     402
     403                $product = wc_get_product( $product_id );
     404                if ( $product && $product->is_sold_individually() ) {
     405                        return $cart_item_data;
     406                }
     407
     408                $cart_item_data[ self::LINE_KEY ] = wp_generate_uuid4();
     409
     410                return $cart_item_data;
    377411        }
    378412
    … …  
    444478
    445479                if ( empty( $values['ppom']['ppom_option_price'] ) && ! empty( $values['ppom']['fields'] ) ) {
    446                         $computed = Helpers::compute_option_price_from_fields( $values['ppom']['fields'], $product_id );
     480                        $computed = Helpers::compute_option_price_from_fields( $values['ppom']['fields'], $product_id, $wc_product );
    447481                        if ( ! empty( $computed ) ) {
    448482                                $values['ppom']['ppom_option_price'] = wp_json_encode( $computed );
    … …  
    513547                                        $resolved_line_price = isset( $option['price'] ) ? $option['price'] : 0;
    514548                                        if ( isset( $option['data_name'] ) && isset( $option['option_id'] ) ) {
    515                                                 $resolved_line_price = Helpers::get_field_option_price_by_id( $option, $wc_product, $ppom_meta_ids );
     549                                                $resolved_line_price = Helpers::get_field_option_price_by_id( $option, $wc_product, $ppom_meta_ids, true );
    516550                                        }
    517551                                }
    … …  
    10881122         * Turns a saved amount into the figure the cart shows.
    10891123         *
    1090          * Percentages resolve against the product base price. The amount stays net, because
     1124         * Percentages resolve against the store-currency product base price, so callers
     1125         * convert flat and percentage amounts the same way. The amount stays net, because
    10911126         * the tax display transformation belongs to the display path alone.
    10921127         *
    … …  
    11041139
    11051140                if ( false !== strpos( $amount, '%' ) ) {
    1106                         $base   = Callbacks::convert_price_back( Helpers::get_product_price( $product, null, 'cart' ) );
     1141                        $base   = Helpers::wcml_store_currency_price( Callbacks::convert_price_back( Helpers::get_product_price( $product, null, 'cart' ) ) );
    11071142                        $amount = Engine::get_amount_after_percentage( $base, $amount );
    11081143                }
  • woocommerce-product-addon/trunk/src/WooCommerce/Order/OrderHandler.php

    r3733313 r3759367  
    1313use PPOM\Files\Handler;
    1414use PPOM\Support\Helpers;
     15use PPOM\WooCommerce\Cart\CartHandler;
    1516
    1617/**
    … …  
    341342         * @param  \WC_Order_Item_Product $item Order Item Product
    342343         * @param  \WC_Order              $order
    343          * @return void
     344         * @return array<string, mixed>
    344345         */
    345346        public static function wc_order_again_compatibility( $cart_item_data, $item, $order ) {
    … …  
    349350                        self::restore_order_files_to_upload_dir( $ppom_data['fields'], $item, $order );
    350351                        $cart_item_data['ppom'] = $ppom_data;
     352                        $cart_item_data         = CartHandler::separate_quantity_controlled_line( $cart_item_data, (int) $item->get_product_id() );
    351353                }
    352354
  • woocommerce-product-addon/trunk/src/WooCommerce/Product/ProductHandler.php

    r3733313 r3759367  
    237237                                }
    238238
    239                                 $computed = Helpers::compute_option_price_from_fields( $fields, $product_id );
     239                                $computed = Helpers::compute_option_price_from_fields( $fields, $product_id, wc_get_product( $variation_id ? $variation_id : $product_id ) );
    240240                                if ( ! empty( $computed ) ) {
    241241                                        $_POST['ppom']['ppom_option_price'] = wp_json_encode( $computed );
  • woocommerce-product-addon/trunk/vendor/codeinwp/themeisle-sdk/load.php

    r3733313 r3759367  
    1515}
    1616// Current SDK version and path.
    17 $themeisle_sdk_version = '3.3.66';
     17$themeisle_sdk_version = '3.3.67';
    1818$themeisle_sdk_path    = dirname( __FILE__ );
    1919
  • woocommerce-product-addon/trunk/vendor/codeinwp/themeisle-sdk/src/Loader.php

    r3720596 r3759367  
    391391                        'connect_cursor'   => 'Add to Cursor',
    392392                        'hint_off'         => 'Your agents can connect once Easy MCP is active.',
    393                         'hint_on'          => 'Each button opens your agent with this site pre-filled. ChatGPT asks you to paste the URL above.',
     393                        'hint_on'          => 'Each button opens your agent with this site pre-filled. In ChatGPT, click Add, then Add custom MCP server, and paste the URL above.',
    394394                        'more_agents'      => 'Using another agent?',
    395395                        'more_agents_link' => 'See how to connect it.',
  • woocommerce-product-addon/trunk/vendor/codeinwp/themeisle-sdk/src/Modules/Ai_connect.php

    r3720596 r3759367  
    740740         * One-click deep links. They mirror Easy MCP's own
    741741         * Admin_Page::build_connect_url() so they can be offered before it runs.
    742          * ChatGPT cannot be pre-filled: the user pastes the URL. Cursor's link wants
     742         * ChatGPT has no link to its form: its link opens the Plugins page, where
     743         * the user adds the server and pastes the URL. Cursor's link wants
    743744         * its `config` as Base64 JSON; the script appends it (window.btoa), because
    744745         * PHP's Base64 function is refused by the WordPress.org plugin check in
    … …  
    756757                return array(
    757758                        'claude'  => 'https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=' . rawurlencode( $name ) . '&connectorUrl=' . rawurlencode( $endpoint ),
    758                         'chatgpt' => 'https://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2Fplugins',
     759                        'chatgpt' => 'https://chatgpt.com/plugins',
    759760                        'cursor'  => 'cursor://anysphere.cursor-deeplink/mcp/install?name=' . rawurlencode( $name ),
    760761                );
  • woocommerce-product-addon/trunk/vendor/codeinwp/themeisle-sdk/src/Modules/Crash_reporter.php

    r3630454 r3759367  
    188188
    189189        /**
    190          * Global handler for uncaught exceptions. Captures the crash and chains to
    191          * the previously registered handler, if any.
     190         * Global handler for uncaught exceptions. Captures the crash, then hands
     191         * the exception on: to the previously registered handler when there is
     192         * one, otherwise back to PHP.
     193         *
     194         * A handler that returns makes PHP end the request as if nothing failed:
     195         * no fatal error is raised or logged and error_get_last() stays empty, so
     196         * WordPress never shows its "critical error" page, never enters recovery
     197         * mode and does not roll back a broken automatic update. Rethrowing keeps
     198         * the request failing exactly as it would without this handler.
    192199         *
    193200         * @param \Throwable $throwable Uncaught exception.
     201         *
     202         * @throws \Throwable The same exception, when no earlier handler exists.
    194203         */
    195204        public static function handle_exception( $throwable ) {
    … …  
    205214                if ( null !== self::$previous_exception_handler && is_callable( self::$previous_exception_handler ) ) {
    206215                        call_user_func( self::$previous_exception_handler, $throwable );
    207                 }
     216
     217                        return;
     218                }
     219
     220                throw $throwable;
    208221        }
    209222
    … …  
    211224         * Shutdown handler. Records supported fatal errors originating from a
    212225         * registered product directory. Never outputs and never exits.
    213          */
    214         public static function handle_shutdown() {
     226         *
     227         * @param array{type: int, message: string, file: string, line: int}|null $error Error to examine. Defaults to
     228         *                                                                             error_get_last(); tests pass a synthetic one.
     229         */
     230        public static function handle_shutdown( $error = null ) {
    215231                self::$reserved_memory = null;
    216232
    217                 $error = error_get_last();
     233                if ( null === $error ) {
     234                        $error = error_get_last();
     235                }
    218236                if ( empty( $error ) || ! isset( $error['type'] ) || ! in_array( (int) $error['type'], self::$fatal_types, true ) ) {
    219237                        return;
  • woocommerce-product-addon/trunk/vendor/composer/installed.json

    r3733313 r3759367  
    33        {
    44            "name": "codeinwp/themeisle-sdk",
    5             "version": "3.3.66",
    6             "version_normalized": "3.3.66.0",
     5            "version": "3.3.67",
     6            "version_normalized": "3.3.67.0",
    77            "source": {
    88                "type": "git",
    99                "url": "https://github.com/Codeinwp/themeisle-sdk.git",
    10                 "reference": "27e095d8357e0594cd5769222af1258538832e75"
     10                "reference": "e1dda44811660a65c3da6994349c054a46686d69"
    1111            },
    1212            "dist": {
    1313                "type": "zip",
    14                 "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/27e095d8357e0594cd5769222af1258538832e75",
    15                 "reference": "27e095d8357e0594cd5769222af1258538832e75",
     14                "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/e1dda44811660a65c3da6994349c054a46686d69",
     15                "reference": "e1dda44811660a65c3da6994349c054a46686d69",
    1616                "shasum": ""
    1717            },
    … …  
    2020                "yoast/phpunit-polyfills": "^4.0"
    2121            },
    22             "time": "2026-10-07T08:46:25+00:00",
     22            "time": "2026-10-13T12:16:34+00:00",
    2323            "type": "library",
    2424            "installation-source": "dist",
    … …  
    4141            "support": {
    4242                "issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
    43                 "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.66"
     43                "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.67"
    4444            },
    4545            "install-path": "../codeinwp/themeisle-sdk"
  • woocommerce-product-addon/trunk/vendor/composer/installed.php

    r3733313 r3759367  
    22    'root' => array(
    33        'name' => 'codeinwp/woocommerce-product-addon',
    4         'pretty_version' => 'v34.0.11',
    5         'version' => '34.0.11.0',
    6         'reference' => '5a5807826d5a5c57941963932f12cbd28558e302',
     4        'pretty_version' => 'v34.0.12',
     5        'version' => '34.0.12.0',
     6        'reference' => '5e981bd06d3e86b4a43699e473dc049d989f3d6c',
    77        'type' => 'project',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1212    'versions' => array(
    1313        'codeinwp/themeisle-sdk' => array(
    14             'pretty_version' => '3.3.66',
    15             'version' => '3.3.66.0',
    16             'reference' => '27e095d8357e0594cd5769222af1258538832e75',
     14            'pretty_version' => '3.3.67',
     15            'version' => '3.3.67.0',
     16            'reference' => 'e1dda44811660a65c3da6994349c054a46686d69',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
    … …  
    2121        ),
    2222        'codeinwp/woocommerce-product-addon' => array(
    23             'pretty_version' => 'v34.0.11',
    24             'version' => '34.0.11.0',
    25             'reference' => '5a5807826d5a5c57941963932f12cbd28558e302',
     23            'pretty_version' => 'v34.0.12',
     24            'version' => '34.0.12.0',
     25            'reference' => '5e981bd06d3e86b4a43699e473dc049d989f3d6c',
    2626            'type' => 'project',
    2727            'install_path' => __DIR__ . '/../../',
  • woocommerce-product-addon/trunk/woocommerce-product-addon.php

    r3733313 r3759367  
    44 * Plugin URI: https://themeisle.com/plugins/ppom-pro/
    55 * Description: PPOM (Personalized Product Option Manager) plugin allow WooCommerce Store Admin to create unlimited input fields and files to attach with Product Pages.
    6  * Version: 34.0.11
     6 * Version: 34.0.12
    77 * Author: Themeisle
    88 * Text Domain: woocommerce-product-addon
    … …  
    3333define( 'PPOM_BASENAME', basename( PPOM_WP_PLUGIN_DIR ) );
    3434define( 'PPOM_PRODUCT_SLUG', PPOM_BASENAME );
    35 define( 'PPOM_VERSION', '34.0.11' );
     35define( 'PPOM_VERSION', '34.0.12' );
    3636define( 'PPOM_DB_VERSION', '32.1.0' );
    3737define( 'PPOM_PRODUCT_META_KEY', '_product_meta_id' );
Note: See TracChangeset for help on using the changeset viewer.