Skip to content

Instantly share code, notes, and snippets.

@imanispatel
Last active August 21, 2020 15:11
Show Gist options
  • Save imanispatel/51aa2f6687227095ec9f5a51b3385048 to your computer and use it in GitHub Desktop.
Save imanispatel/51aa2f6687227095ec9f5a51b3385048 to your computer and use it in GitHub Desktop.
Remove province/state code in guest user data while send to Wave
<?php
/**
* Set custom guest user variable for WooCommerce Wave Connector
* Remove province code in guest user variable.
*
* @param array $variable get variable.
* @param array $order_id get order id.
* @return array
*/
function venus_wc_custom_guest_user_variable( $variable, $order_id ) {
unset( $variable['address']['provinceCode'] );
if ( isset( $variable['shippingDetails']['address']['provinceCode'] ) ) {
unset( $variable['shippingDetails']['address']['provinceCode'] );
}
return $variable;
}
add_action( 'venus_wc_export_guest_customer_variables', 'venus_wc_custom_guest_user_variable', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment