View Categories

How to use Chwazi custom JavaScript events

Chwazi comes with two custom JavaScript events that can help you perform actions based on the order type selected. Using the snippet below, you can see a console message appear based on the order type selected.

Using this logic, you can write custom JavaScript to perform your custom logic:

function sl_cc_catch_chwazi_js_events(){
	echo "
	<script>
		document.addEventListener('custom:dpsCustomerSwitchedToPickup', function(){
		
		console.log('pickup button clicked');
		
		})
		
		document.addEventListener('custom:dpsCustomerSwitchedToDelivery', function(){
		
		console.log('delivery button clicked');
		
		})
		
	</script>
	";
}
add_action('wp_head', 'sl_cc_catch_chwazi_js_events');

Checkout our Google Calendar Add-on

Track Your WooCommerce Orders inside Google Calendar

Learn More