1jQuery(document).ready(function ($) { 2 3 jQuery(document.body).on('added_to_cart', function( event, fragments, cart_hash, button_pressed ) { 4 updateProductMessage(); 5 }); 6 7 function updateProductMessage() { 8 9 let scriptData = wdp_condition_message_script_data; 10 11 let productIds = [] 12 jQuery('li.product [data-product_id]').each(function () { 13 productIds.push(jQuery(this).data('product_id')) 14 }) 15 16 let data = { 17 action: 'get-condition-message-products', 18 product_ids: productIds, 19 }; 20 21 data[scriptData.security_query_arg] = scriptData.security; 22 23 jQuery.ajax({ 24 context: this, 25 url: scriptData.ajaxurl, 26 data: data, 27 type: 'POST', 28 async: false, 29 success: function (response) { 30 31 if (!response.success) { 32 return; 33 } 34 35 productIds.forEach(function (productId) { 36 jQuery('[data-product_id="'+ productId +'"]') 37 .closest('li.product') 38 .find('.adp-condition-message') 39 .html(response.data.messages[productId]) 40 }) 41 }, 42 }); 43 } 44})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.