Skip to content

Commit 2b24b23

Browse files
authored
Merge pull request #408 from Codeinwp/fix/hidden-fields-on-price
fix: `CustomEvent` not properly triggering jQuery event for hidden fields workflow
2 parents fb3bee3 + 7531c36 commit 2b24b23

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

classes/frontend-scripts.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ public static function load_scripts_by_product_id( $product_id, $ppom_id = null,
507507
array(
508508
'jquery',
509509
'ppom-inputs',
510-
)
510+
),
511+
PPOM_VERSION
511512
);
512513

513514
self::set_localize_data( $ppom_conditions_script, 'ppom_input_vars', $product, $input_js_vars, $global_js_vars );

js/ppom-conditions-v2.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,11 @@ jQuery(function($) {
6161

6262
const data_name = modifiedElement.dataset?.data_name;
6363
ppom_check_conditions(data_name, (element_dataname, event_type) => {
64-
const event = new CustomEvent(event_type, {
65-
detail: {
66-
field: element_dataname,
67-
time: new Date()
68-
}
64+
$.event.trigger({
65+
type: event_type,
66+
field: element_dataname,
67+
time: new Date()
6968
});
70-
document.dispatchEvent(event);
7169
});
7270
}
7371

0 commit comments

Comments
 (0)