Skip to content

Instantly share code, notes, and snippets.

@rajeshsingh520
Created October 27, 2025 02:21
Show Gist options
  • Select an option

  • Save rajeshsingh520/ed0183085b3e8e1a7c2c8f1228adee47 to your computer and use it in GitHub Desktop.

Select an option

Save rajeshsingh520/ed0183085b3e8e1a7c2c8f1228adee47 to your computer and use it in GitHub Desktop.
add_action( 'wp_enqueue_scripts', function () {
$js = "
jQuery(document).on('pi_add_to_enquiry_data', function(e, data){
if(jQuery('.wc-pao-addon-container').length == 0) return;
jQuery('.wc-pao-addon-container').each(function(){
var label = jQuery('.wc-pao-addon-name', this).text().trim();
var price = jQuery('input', this).val().trim();
if(price != ''){
data['variation_detail'][label] = price;
}
})
});
";
wp_add_inline_script('jquery', $js, 'after');
}, 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment