diff --git a/classes/inputs/input.measure.php b/classes/inputs/input.measure.php
index ed40a28b..9a073f0d 100644
--- a/classes/inputs/input.measure.php
+++ b/classes/inputs/input.measure.php
@@ -36,6 +36,7 @@ function change_option_label( $label, $option, $meta, $product ) {
}
$price = isset( $option['price'] ) ? $option['price'] : 0;
+ $price = apply_filters( 'ppom_option_price', $price );
$price = wc_price( $price );
$label = $price . '/' . $option['option'];
diff --git a/classes/plugin.class.php b/classes/plugin.class.php
index 221183eb..6c1d6b15 100644
--- a/classes/plugin.class.php
+++ b/classes/plugin.class.php
@@ -354,6 +354,8 @@ public function __construct() {
add_filter( 'woocommerce_order_again_cart_item_data', 'ppom_wc_order_again_compatibility', 10, 3 );
// Show description tooltip.
add_filter( 'ppom_field_description', array( $this, 'show_tooltip' ), 15, 2 );
+
+ add_filter( 'ppom_option_price', array( $this, 'ppom_convert_price' ), 99, 1 );
}
/*
@@ -1094,4 +1096,40 @@ public function is_license_of_type( $type ) {
return false;
}
+
+ /**
+ * Convert price using active multi-currency plugin's filter or function.
+ *
+ * @param float|int|string|null $price The price to convert.
+ * @return float|int|string|null The converted price.
+ */
+ public function ppom_convert_price( $price ) {
+ if ( '' === $price || null === $price ) {
+ return $price;
+ }
+ if ( is_string( $price ) && false !== strpos( $price, '%' ) ) {
+ return $price;
+ }
+ if ( ! is_numeric( $price ) ) {
+ return $price;
+ }
+ $numeric_price = (float) $price;
+
+ // WCML.
+ if ( has_filter( 'wcml_raw_price_amount' ) ) {
+ return apply_filters( 'wcml_raw_price_amount', $numeric_price );
+ }
+
+ // FOX - Currency Switcher.
+ if ( has_filter( 'woocs_exchange_value' ) ) {
+ return apply_filters( 'woocs_exchange_value', $numeric_price );
+ }
+
+ // CURCY - WooCommerce Multi Currency.
+ if ( function_exists( 'wmc_get_price' ) ) {
+ return wmc_get_price( $numeric_price );
+ }
+
+ return $price;
+ }
}
diff --git a/inc/admin.php b/inc/admin.php
index 19f71933..5c45428e 100644
--- a/inc/admin.php
+++ b/inc/admin.php
@@ -913,28 +913,28 @@ function ppom_admin_bar_menu() {
function ppom_add_black_friday_data( $configs ) {
$config = $configs['default'];
- $message = __( 'Conditional fields, file uploads, pricing formulas. Let customers configure products the way they need. Exclusively for existing PPOM users.', 'woocommerce-product-addon' );
+ $message = __( 'Conditional fields, file uploads, pricing formulas. Let customers configure products the way they need. Exclusively for existing PPOM users.', 'woocommerce-product-addon' );
$cta_label = __( 'Get PPOM Pro', 'woocommerce-product-addon' );
- $plan = apply_filters( 'product_ppom_license_plan', 0 );
- $license = apply_filters( 'product_ppom_license_key', false );
- $status = apply_filters( 'product_ppom_license_status', false );
+ $plan = apply_filters( 'product_ppom_license_plan', 0 );
+ $license = apply_filters( 'product_ppom_license_key', false );
+ $status = apply_filters( 'product_ppom_license_status', false );
$pro_product_slug = defined( 'PPOM_PRO_BASENAME' ) ? PPOM_PRO_BASENAME : '';
- $is_pro = 'valid' === $status;
+ $is_pro = 'valid' === $status;
$is_expired = 'expired' === $status || 'active-expired' === $status;
if ( $is_pro ) {
// translators: %s is the discount percentage.
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - up to %s off', 'woocommerce-product-addon' ), '30%' );
// translators: %1$s - discount, %2$s - discount.
- $message = sprintf( __( 'Upgrade your PPOM Pro plan: %1$s off this week. Already on the plan you need? Renew early and save up to %2$s.', 'woocommerce-product-addon' ), '30%', '20%' );
+ $message = sprintf( __( 'Upgrade your PPOM Pro plan: %1$s off this week. Already on the plan you need? Renew early and save up to %2$s.', 'woocommerce-product-addon' ), '30%', '20%' );
$cta_label = __( 'See your options', 'woocommerce-product-addon' );
} elseif ( $is_expired ) {
// translators: %s is the discount percentage.
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - %s off', 'woocommerce-product-addon' ), '50%' );
- $message = __( 'Your PPOM Pro features are still here, just locked. Renew at a reduced rate this week.', 'woocommerce-product-addon' );
- $cta_label = __( 'Reactivate now', 'woocommerce-product-addon' );
+ $message = __( 'Your PPOM Pro features are still here, just locked. Renew at a reduced rate this week.', 'woocommerce-product-addon' );
+ $cta_label = __( 'Reactivate now', 'woocommerce-product-addon' );
} else {
// translators: %s is the discount percentage.
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - %s off', 'woocommerce-product-addon' ), '60%' );
@@ -942,7 +942,7 @@ function ppom_add_black_friday_data( $configs ) {
$config['title'] = sprintf( __( 'PPOM Pro: %s off this week', 'woocommerce-product-addon' ), '60%' );
}
- $url_params = array(
+ $url_params = array(
'utm_term' => $is_pro ? 'plan-' . $plan : 'free',
'lkey' => ! empty( $license ) ? $license : false,
'expired' => $is_expired ? '1' : false,
diff --git a/inc/nmInput.class.php b/inc/nmInput.class.php
index f7c9bd60..adb49e37 100644
--- a/inc/nmInput.class.php
+++ b/inc/nmInput.class.php
@@ -139,6 +139,7 @@ public function Regular( $args, $default_value = '' ) {
$onetime = $this->get_attribute_value( 'onetime', $args );
$taxable = $this->get_attribute_value( 'taxable', $args );
$price = $this->get_attribute_value( 'price', $args );
+ $price = apply_filters( 'ppom_option_price', $price );
$price_without_tax = '';
// Only title without description for price calculation etc.
@@ -277,8 +278,9 @@ public function Measure( $args, $default_value = '' ) {
// $measure_label = $option['label'].'/'.$
$option_id = $option['option_id'];
$unit = $option['raw'];
+ $price = apply_filters( 'ppom_option_price', $option['price'] );
$html .= '', $option['price'], esc_attr( $data_label ), $id, $unit, $option_id );
+ $html .= sprintf( 'data-use_units="' . esc_attr( $use_units ) . '" data-price="%s" data-label="%s" data-data_name="%s" data-unit="%s" data-optionid="%s">', $price, esc_attr( $data_label ), $id, $unit, $option_id );
$html .= '';
@@ -481,7 +483,7 @@ public function Select( $args, $selected_value = '' ) {
// ppom_pa($value);
$option_label = $value['label'];
- $option_price = $value['price'];
+ $option_price = apply_filters( 'ppom_option_price', $value['price'] );
$option_id = isset( $value['id'] ) ? $value['id'] : '';
$raw_label = $value['raw'];
$without_tax = $value['without_tax'];
@@ -660,7 +662,7 @@ public function Checkbox( $args, $checked_value = array() ) {
foreach ( $options as $key => $value ) {
$option_label = $value['label'];
- $option_price = $value['price'];
+ $option_price = apply_filters( 'ppom_option_price', $value['price'] );
$raw_label = $value['raw'];
$without_tax = $value['without_tax'];
$option_id = $value['option_id'];
@@ -743,7 +745,7 @@ public function Radio( $args, $checked_value = '' ) {
foreach ( $options as $key => $value ) {
$option_label = $value['label'];
- $option_price = $value['price'];
+ $option_price = apply_filters( 'ppom_option_price', $value['price'] );
$raw_label = $value['raw'];
$without_tax = $value['without_tax'];
$option_id = $value['option_id'];
@@ -850,7 +852,7 @@ public function Palettes( $args, $default_value = '' ) {
$color_label = $value['label'];
$option_label = $value['label'];
- $option_price = $value['price'];
+ $option_price = apply_filters( 'ppom_option_price', $value['price'] );
$raw_label = $value['raw'];
$without_tax = $value['without_tax'];
@@ -974,6 +976,7 @@ public function Image( $args, $default_value = '' ) {
$image_title = isset( $image['raw'] ) ? stripslashes( $image['raw'] ) : '';
$image_label = isset( $image['label'] ) ? stripslashes( $image['label'] ) : '';
$image_price = isset( $image['price'] ) ? $image['price'] : 0;
+ $image_price = apply_filters( 'ppom_option_price', $image_price );
$option_id = $id . '-' . $image_id;
// If price set in %
@@ -1069,6 +1072,7 @@ public function Image( $args, $default_value = '' ) {
$image_title = isset( $image['raw'] ) ? stripslashes( $image['raw'] ) : '';
$image_label = isset( $image['label'] ) ? stripslashes( $image['label'] ) : '';
$image_price = isset( $image['price'] ) ? $image['price'] : 0;
+ $image_price = apply_filters( 'ppom_option_price', $image_price );
$option_id = $id . '-' . $image_id;
// If price set in %
@@ -1183,6 +1187,7 @@ public function Pricematrix( $args, $default_value = '' ) {
if ( ! $is_hidden ) {
foreach ( $ranges as $opt ) {
$price = isset( $opt['raw_price'] ) ? trim( $opt['raw_price'] ) : 0;
+ $price = apply_filters( 'ppom_option_price', $price );
$label = isset( $opt['label'] ) ? $opt['label'] : $opt['raw'];
if ( ! empty( $opt['percent'] ) ) {
@@ -1357,6 +1362,7 @@ public function Audio_video( $args, $default_value = '' ) {
$audio_id = isset( $audio['id'] ) ? $audio['id'] : 0;
$audio_title = isset( $audio['title'] ) ? stripslashes( $audio['title'] ) : 0;
$audio_price = isset( $audio['price'] ) ? $audio['price'] : 0;
+ $audio_price = apply_filters( 'ppom_option_price', $audio_price );
// Actually image URL is link
$audio_url = wp_get_attachment_url( $audio_id );
@@ -1565,6 +1571,7 @@ public function Cropper( $args, $selected_value = '' ) {
$option_label = $size['label'];
$option_price = $size['price'];
+ $option_price = apply_filters( 'ppom_option_price', $option_price );
$raw_label = $size['raw'];
$without_tax = $size['without_tax'];
$option_id = $size['option_id'];
diff --git a/inc/prices.php b/inc/prices.php
index c363eeb7..ef8c1bbd 100644
--- a/inc/prices.php
+++ b/inc/prices.php
@@ -821,6 +821,7 @@ function ppom_generate_field_price( $field_price, $field_meta, $apply, $option =
$taxable = ( isset( $field_meta['onetime_taxable'] ) && $field_meta['onetime_taxable'] == 'on' ) ? true : false;
$option_label = isset( $option['raw'] ) ? $option['raw'] : '';
$without_tax = isset( $option['without_tax'] ) ? $option['without_tax'] : '';
+ $field_price = apply_filters( 'ppom_option_price', $field_price );
$label_price = "{$field_title} - " . wc_price( $field_price );
// For bulkquantity
diff --git a/inc/woocommerce.php b/inc/woocommerce.php
index 4371a482..9abd1d84 100644
--- a/inc/woocommerce.php
+++ b/inc/woocommerce.php
@@ -701,7 +701,7 @@ function ppom_woocommerce_mini_cart_fixed_fee() {
$item_fee = $fee->total + $fee->tax;
}
- // var_dump($fee);
+ $item_fee = apply_filters( 'ppom_option_price', $item_fee );
$fixed_fee_html .= '
';
$fixed_fee_html .= '| ' . esc_html( $fee->name );
' | ';
@@ -736,6 +736,8 @@ function ppom_woocommerce_add_item_meta( $item_meta, $cart_item ) {
$meta_name = isset( $meta['name'] ) ? $meta['name'] : '';
$meta_value = isset( $meta['value'] ) ? $meta['value'] : '';
$display = isset( $meta['display'] ) ? $meta['display'] : $meta_value;
+ $meta_price = isset( $meta['price'] ) ? $meta['price'] : 0;
+ $meta_price = apply_filters( 'ppom_option_price', $meta_price );
if ( $key == 'ppom_has_quantities' ) {
$hidden = true;
}
@@ -757,8 +759,8 @@ function ppom_woocommerce_add_item_meta( $item_meta, $cart_item ) {
$meta_value = wp_json_encode( $meta_value );
}
- if ( apply_filters( 'ppom_show_option_price_cart', false ) && isset( $meta['price'] ) ) {
- $meta_value .= ' (' . wc_price( $meta['price'] ) . ')';
+ if ( apply_filters( 'ppom_show_option_price_cart', false ) && ! empty( $meta_price ) ) {
+ $meta_value .= ' (' . wc_price( $meta_price ) . ')';
}
$meta_key = stripslashes( $meta_name );
@@ -839,8 +841,8 @@ function ppom_woocommerce_alter_price( $price, $product ) {
$least_price = floatval( $product->get_price() ) - $least_price;
$least_price = wc_format_decimal( $least_price, wc_get_price_decimals() );
- // var_dump($least_price);
- $price = wc_price( $least_price ) . '-' . $price;
+ $least_price = apply_filters( 'ppom_option_price', $least_price );
+ $price = wc_price( $least_price ) . '-' . $price;
} else {
foreach ( $ranges as $range ) {
diff --git a/phpcs.baseline.xml b/phpcs.baseline.xml
index e0d9c8c7..f13a3ad0 100644
--- a/phpcs.baseline.xml
+++ b/phpcs.baseline.xml
@@ -788,7 +788,6 @@
-
@@ -818,7 +817,6 @@
-
@@ -861,7 +859,6 @@
-
@@ -887,7 +884,6 @@
-
@@ -896,11 +892,9 @@
-
-
@@ -924,18 +918,15 @@
-
-
-
@@ -1082,25 +1073,25 @@
-
+
-
+
-
+
@@ -1118,11 +1109,11 @@
-
+
+
-
@@ -2195,7 +2186,6 @@
-
@@ -2235,7 +2225,6 @@
-
@@ -2267,7 +2256,6 @@
-
@@ -2283,7 +2271,6 @@
-
@@ -2578,11 +2565,9 @@
-
-
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index 16aa9c22..c7e878c8 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -5622,12 +5622,6 @@ parameters:
count: 1
path: inc/nmInput.class.php
- -
- message: '#^Parameter \#1 \$price of function wc_price expects float, int\|string given\.$#'
- identifier: argument.type
- count: 2
- path: inc/nmInput.class.php
-
-
message: '#^Parameter \#1 \$text of function esc_attr expects string, bool given\.$#'
identifier: argument.type
@@ -6936,12 +6930,6 @@ parameters:
count: 1
path: inc/woocommerce.php
- -
- message: '#^Parameter \#1 \$price of function wc_price expects float, string given\.$#'
- identifier: argument.type
- count: 1
- path: inc/woocommerce.php
-
-
message: '#^Parameter \#1 \$product of function ppom_hooks_load_input_scripts expects int\|WC_Product, WC_Product\|false\|null given\.$#'
identifier: argument.type
@@ -7308,12 +7296,6 @@ parameters:
count: 1
path: templates/frontend/inputs/palettes.php
- -
- message: '#^Parameter \#1 \$price of function wc_price expects float, int\|string given\.$#'
- identifier: argument.type
- count: 2
- path: templates/frontend/inputs/pricematrix.php
-
-
message: '#^Parameter \#1 \$text of function esc_attr expects string, string\|false given\.$#'
identifier: argument.type
diff --git a/templates/frontend/component/quantities/grid-layout.php b/templates/frontend/component/quantities/grid-layout.php
index a55894d1..41c4583f 100644
--- a/templates/frontend/component/quantities/grid-layout.php
+++ b/templates/frontend/component/quantities/grid-layout.php
@@ -55,8 +55,6 @@
$out_of_stock = $manage_stock && $stock < 1 ? true : false;
$disabled = $out_of_stock ? 'disabled="disabled"' : '';
$min = $out_of_stock ? 0 : $min;
-
- $the_price = isset( $opt['price'] ) ? $opt['price'] : $default_price;
$usebaseprice = isset( $opt['price'] ) ? 'no' : 'yes';
$label = $opt['raw'];
@@ -86,6 +84,7 @@
diff --git a/templates/frontend/component/quantities/horizontal-layout.php b/templates/frontend/component/quantities/horizontal-layout.php
index 9e28f5bb..f37fe4b8 100644
--- a/templates/frontend/component/quantities/horizontal-layout.php
+++ b/templates/frontend/component/quantities/horizontal-layout.php
@@ -43,10 +43,7 @@
|
-
+
|
@@ -61,6 +58,7 @@
// Price need to filter for currency switcher here not in wc_price
$the_price = isset( $opt['price'] ) && $opt['price'] != '' ? $opt['price'] : $default_price;
+ $the_price = apply_filters( 'ppom_option_price', $the_price );
$usebaseprice = isset( $opt['price'] ) ? 'no' : 'yes';
$min = ( ! empty( $opt['min'] ) ? $opt['min'] : 0 );
diff --git a/templates/frontend/component/quantities/vertical-layout.php b/templates/frontend/component/quantities/vertical-layout.php
index c59325dc..7807dd22 100644
--- a/templates/frontend/component/quantities/vertical-layout.php
+++ b/templates/frontend/component/quantities/vertical-layout.php
@@ -76,6 +76,7 @@
// Price need to filter for currency switcher here not in wc_price
$the_price = isset( $opt['price'] ) && $opt['price'] != '' ? $opt['price'] : $default_price;
+ $the_price = apply_filters( 'ppom_option_price', $the_price );
$usebaseprice = isset( $opt['price'] ) ? 'no' : 'yes';
$required = ( $fm->required() == 'on' ? 'required' : '' );
diff --git a/templates/frontend/inputs/audio.php b/templates/frontend/inputs/audio.php
index cb7b98ed..439d646b 100644
--- a/templates/frontend/inputs/audio.php
+++ b/templates/frontend/inputs/audio.php
@@ -44,6 +44,7 @@
$audio_id = isset( $audio['id'] ) ? $audio['id'] : 0;
$audio_title = isset( $audio['title'] ) ? stripslashes( $audio['title'] ) : 0;
$audio_price = isset( $audio['price'] ) ? $audio['price'] : 0;
+ $audio_price = apply_filters( 'ppom_option_price', $audio_price );
// Actually image URL is link
$audio_url = wp_get_attachment_url( $audio_id );
diff --git a/templates/frontend/inputs/checkbox.php b/templates/frontend/inputs/checkbox.php
index 51a9ab78..b845481f 100644
--- a/templates/frontend/inputs/checkbox.php
+++ b/templates/frontend/inputs/checkbox.php
@@ -92,6 +92,8 @@ function ( $v ) {
$option_id = $value['option_id'];
$dom_id = apply_filters( 'ppom_dom_option_id', $option_id, $field_meta );
$opt_percent = isset( $value['percent'] ) ? $value['percent'] : '';
+ $option_price = apply_filters( 'ppom_option_price', $option_price );
+ $discount_price = apply_filters( 'ppom_option_price', $discount_price );
// if discount price set
if ( $has_discount ) {
diff --git a/templates/frontend/inputs/color.php b/templates/frontend/inputs/color.php
index 6ac9149e..17f33663 100644
--- a/templates/frontend/inputs/color.php
+++ b/templates/frontend/inputs/color.php
@@ -20,6 +20,7 @@
$taxable = $fm->get_meta_value( 'onetime_taxable' );
$input_attr = $fm->get_meta_value( 'attributes' );
$price = $fm->get_meta_value( 'price' );
+$price = apply_filters( 'ppom_option_price', $price );
$price_without_tax = '';
if ( $onetime == 'on' && $taxable == 'on' ) {
diff --git a/templates/frontend/inputs/cropper.php b/templates/frontend/inputs/cropper.php
index 38c7d7b5..75698381 100644
--- a/templates/frontend/inputs/cropper.php
+++ b/templates/frontend/inputs/cropper.php
@@ -23,6 +23,7 @@
$btn_class = $fm->get_meta_value( 'button_class' );
$btn_label = $fm->get_meta_value( 'button_label_select' );
$first_option = $fm->get_meta_value( 'first_option' );
+$file_cost = apply_filters( 'ppom_option_price', $file_cost );
$field_label = ( $file_cost == '' ) ? $fm->field_label() : $fm->field_label() . ' - ' . wc_price( $file_cost );
$btn_label = ( $btn_label == '' ? __( 'Select files', 'woocommerce-product-addon' ) : $btn_label );
@@ -91,6 +92,7 @@ class=""
$raw_label = $size['raw'];
$without_tax = $size['without_tax'];
$option_id = $size['option_id'];
+ $option_price = apply_filters( 'ppom_option_price', $option_price );
$selected_opt = selected( $default_value, $key, false );
diff --git a/templates/frontend/inputs/date.php b/templates/frontend/inputs/date.php
index 7696c142..34378b29 100644
--- a/templates/frontend/inputs/date.php
+++ b/templates/frontend/inputs/date.php
@@ -21,6 +21,7 @@
$input_attr = $fm->get_meta_value( 'attributes' );
$jquery_dp = $fm->get_meta_value( 'jquery_dp' );
$price = $fm->get_meta_value( 'price' );
+$price = apply_filters( 'ppom_option_price', $price );
$price_without_tax = '';
if ( $onetime == 'on' && $taxable == 'on' ) {
diff --git a/templates/frontend/inputs/daterange.php b/templates/frontend/inputs/daterange.php
index 9a69b57c..fcb4819f 100644
--- a/templates/frontend/inputs/daterange.php
+++ b/templates/frontend/inputs/daterange.php
@@ -20,6 +20,7 @@
$taxable = $fm->get_meta_value( 'onetime_taxable' );
$input_attr = $fm->get_meta_value( 'attributes' );
$price = $fm->get_meta_value( 'price' );
+$price = apply_filters( 'ppom_option_price', $price );
$price_without_tax = '';
if ( $onetime == 'on' && $taxable == 'on' ) {
diff --git a/templates/frontend/inputs/email.php b/templates/frontend/inputs/email.php
index 2ffba0be..f2a3e7a1 100644
--- a/templates/frontend/inputs/email.php
+++ b/templates/frontend/inputs/email.php
@@ -20,6 +20,7 @@
$taxable = $fm->get_meta_value( 'onetime_taxable' );
$input_attr = $fm->get_meta_value( 'attributes' );
$price = $fm->get_meta_value( 'price' );
+$price = apply_filters( 'ppom_option_price', $price );
$price_without_tax = '';
diff --git a/templates/frontend/inputs/file.php b/templates/frontend/inputs/file.php
index 7dab9ba8..86aea5ea 100644
--- a/templates/frontend/inputs/file.php
+++ b/templates/frontend/inputs/file.php
@@ -23,6 +23,7 @@
$btn_class = $fm->get_meta_value( 'button_class' );
$btn_label = $fm->get_meta_value( 'button_label_select' );
$input_classes = $fm->input_classes();
+$file_cost = apply_filters( 'ppom_option_price', $file_cost );
$field_label = ( $file_cost == '' ) ? $fm->field_label() : $fm->field_label() . ' - ' . wc_price( $file_cost );
$btn_label = ( $btn_label == '' ? __( 'Select files', 'woocommerce-product-addon' ) : $btn_label );
diff --git a/templates/frontend/inputs/image.php b/templates/frontend/inputs/image.php
index 334a2fee..2304eade 100644
--- a/templates/frontend/inputs/image.php
+++ b/templates/frontend/inputs/image.php
@@ -64,6 +64,7 @@
$image_price = isset( $image['price'] ) ? $image['price'] : 0;
$option_id = $fm->data_name() . '-' . $image_id;
$opt_percent = isset( $value['percent'] ) ? $value['percent'] : '';
+ $image_price = apply_filters( 'ppom_option_price', $image_price );
// If price set in %
if ( strpos( $image['price'], '%' ) !== false ) {
@@ -167,6 +168,7 @@ class=""
$image_price = isset( $image['price'] ) ? $image['price'] : 0;
$option_id = $fm->data_name() . '-' . $image_id;
$opt_percent = isset( $image['percent'] ) ? $image['percent'] : '';
+ $image_price = apply_filters( 'ppom_option_price', $image_price );
// Actually image URL is link
diff --git a/templates/frontend/inputs/number.php b/templates/frontend/inputs/number.php
index 371ea697..85301760 100644
--- a/templates/frontend/inputs/number.php
+++ b/templates/frontend/inputs/number.php
@@ -20,6 +20,7 @@
$taxable = $fm->get_meta_value( 'onetime_taxable' );
$input_attr = $fm->get_meta_value( 'attributes' );
$price = $fm->get_meta_value( 'price' );
+$price = apply_filters( 'ppom_option_price', $price );
$price_without_tax = '';
if ( $onetime == 'on' && $taxable == 'on' ) {
diff --git a/templates/frontend/inputs/palettes.php b/templates/frontend/inputs/palettes.php
index 46f280d6..7af298eb 100644
--- a/templates/frontend/inputs/palettes.php
+++ b/templates/frontend/inputs/palettes.php
@@ -79,7 +79,7 @@
$color_label = $value['label'];
$option_label = $value['label'];
- $option_price = $value['price'];
+ $option_price = apply_filters( 'ppom_option_price', $value['price'] );
$raw_label = $value['raw'];
$without_tax = $value['without_tax'];
diff --git a/templates/frontend/inputs/pricematrix.php b/templates/frontend/inputs/pricematrix.php
index 0320d21d..40e8b853 100644
--- a/templates/frontend/inputs/pricematrix.php
+++ b/templates/frontend/inputs/pricematrix.php
@@ -51,6 +51,7 @@
$price = isset( $opt['price'] ) ? trim( $opt['price'] ) : 0;
$label = isset( $opt['label'] ) ? $opt['label'] : $opt['raw'];
$range_id = isset( $value['option_id'] ) ? $value['option_id'] : '';
+ $price = apply_filters( 'ppom_option_price', $price );
if ( ! empty( $opt['percent'] ) ) {
diff --git a/templates/frontend/inputs/radio.php b/templates/frontend/inputs/radio.php
index a0b63fd0..d8fad8e3 100644
--- a/templates/frontend/inputs/radio.php
+++ b/templates/frontend/inputs/radio.php
@@ -49,7 +49,7 @@
foreach ( $options as $key => $value ) {
$option_label = $value['label'];
- $option_price = $value['price'];
+ $option_price = apply_filters( 'ppom_option_price', $value['price'] );
$raw_label = $value['raw'];
$without_tax = $value['without_tax'];
$option_id = $value['option_id'];
diff --git a/templates/frontend/inputs/select.php b/templates/frontend/inputs/select.php
index 3b16dbe3..f47c8ce0 100644
--- a/templates/frontend/inputs/select.php
+++ b/templates/frontend/inputs/select.php
@@ -64,7 +64,7 @@ class="input_classes() ); ?>"
foreach ( $options as $key => $value ) {
$option_label = $value['label'];
- $option_price = $value['price'];
+ $option_price = apply_filters( 'ppom_option_price', $value['price'] );
$option_id = isset( $value['id'] ) ? $value['id'] : '';
$raw_label = $value['raw'];
$without_tax = $value['without_tax'];
diff --git a/templates/frontend/inputs/text.php b/templates/frontend/inputs/text.php
index 56004461..64400ffc 100644
--- a/templates/frontend/inputs/text.php
+++ b/templates/frontend/inputs/text.php
@@ -21,6 +21,7 @@
$onetime = $fm->get_meta_value( 'onetime' );
$taxable = $fm->get_meta_value( 'onetime_taxable' );
$price = $fm->get_meta_value( 'price' );
+$price = apply_filters( 'ppom_option_price', $price );
$input_attr = $fm->get_meta_value( 'attributes' );
// Regex-Input Mask (Since 18.0)
diff --git a/templates/input/quantities.php b/templates/input/quantities.php
index 0fe9564d..9d996a21 100644
--- a/templates/input/quantities.php
+++ b/templates/input/quantities.php
@@ -39,6 +39,7 @@
' . wc_price( $the_price ) . '';
}
@@ -109,7 +110,6 @@
$min = ( isset( $opt['min'] ) ? $opt['min'] : 0 );
$max = ( isset( $opt['max'] ) ? $opt['max'] : 10000 );
- $the_price = isset( $opt['price'] ) ? $opt['price'] : $default_price;
$usebaseprice = isset( $opt['price'] ) ? 'no' : 'yes';
$label = $opt['option'];
@@ -139,17 +139,12 @@
' . wc_price( $the_price ) . '';
}
?>
-
-
-
' . wc_price( $the_price ) . '';
}
@@ -196,9 +192,6 @@
$min = ( isset( $opt['min'] ) ? $opt['min'] : 0 );
$max = ( isset( $opt['max'] ) ? $opt['max'] : 10000 );
- // Price need to filter for currency switcher here not in wc_price
- $the_price = apply_filters( 'ppom_option_price', $the_price );
-
$usebaseprice = isset( $opt['price'] ) ? 'no' : 'yes';
$label = $opt['option'];
diff --git a/templates/render-fields.php b/templates/render-fields.php
index 5a91770f..84ca12c7 100644
--- a/templates/render-fields.php
+++ b/templates/render-fields.php
@@ -649,6 +649,7 @@ function ( $collapse_field ) {
$file_cost = ( isset( $meta ['file_cost'] ) ? $meta ['file_cost'] : '' );
$taxable = ( isset( $meta['onetime_taxable'] ) ? $meta['onetime_taxable'] : '' );
$language = ( isset( $meta['language_opt'] ) ? $meta['language_opt'] : '' );
+ $file_cost = apply_filters( 'ppom_option_price', $file_cost );
$field_label = ( $file_cost == '' ) ? $field_label : $field_label . ' - ' . wc_price( $file_cost );
@@ -693,6 +694,7 @@ function ( $collapse_field ) {
$taxable = ( isset( $meta['onetime_taxable'] ) ? $meta['onetime_taxable'] : '' );
$language = ( isset( $meta['language_opt'] ) ? $meta['language_opt'] : '' );
$file_cost = ( isset( $meta ['file_cost'] ) ? $meta ['file_cost'] : '' );
+ $file_cost = apply_filters( 'ppom_option_price', $file_cost );
$field_label = ( $file_cost == '' ) ? $field_label : $field_label . ' - ' . wc_price( $file_cost );
$first_option = isset( $meta['first_option'] ) ? $meta['first_option'] : '';
$options = ppom_convert_options_to_key_val( $options, $meta, $product );
diff --git a/woocommerce-product-addon.php b/woocommerce-product-addon.php
index 725133ea..385cc2f7 100644
--- a/woocommerce-product-addon.php
+++ b/woocommerce-product-addon.php
@@ -200,4 +200,4 @@ function () {
);
register_activation_hook( __FILE__, array( 'NM_PersonalizedProduct', 'activate_plugin' ) );
-register_deactivation_hook( __FILE__, array( 'NM_PersonalizedProduct', 'deactivate_plugin' ) );
\ No newline at end of file
+register_deactivation_hook( __FILE__, array( 'NM_PersonalizedProduct', 'deactivate_plugin' ) );