Skip to content

Instantly share code, notes, and snippets.

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