1// File: your-bridge-plugin/assets/express-checkout-delivery-date.js 2 3( function () { 4 // Wait until wp.hooks is available (loaded by WooPayments). 5 function init() { 6 if ( ! window.wp || ! window.wp.hooks ) { 7 return; 8 } 9 10 wp.hooks.addFilter( 11 'wcpay.express-checkout.cart-place-order-extension-data', 12 'orddd/express-checkout-delivery-date', 13 function ( extensionData ) { 14 var eDate = document.getElementById( 'e_deliverydate' ); 15 var hDate = document.getElementById( 'h_deliverydate' ); 16 var timeSlot = localStorage.getItem( 'orddd_lite_time_slot' ); 17 18 if ( ! eDate || ! eDate.value ) { 19 return extensionData; 20 } 21 22 var deliveryData = { 23 e_deliverydate: eDate.value, 24 h_deliverydate: hDate ? hDate.value : eDate.value, 25 }; 26 27 if ( timeSlot && timeSlot !== '' && timeSlot !== 'select' && timeSlot !== 'choose' && timeSlot !== 'NA' ) { 28 deliveryData.orddd_lite_time_slot = timeSlot; 29 } 30 31 return Object.assign( {}, extensionData, { 32 'order-delivery-date': deliveryData 33 } ); 34 } 35 ); 36 } 37 38 // The filter must be registered before the ECE JS fires. 39 // DOMContentLoaded is early enough. 40 if ( document.readyState === 'loading' ) { 41 document.addEventListener( 'DOMContentLoaded', init ); 42 } else { 43 init(); 44 } 45} )();
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.