Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #4513008
Anonymizing Name Display & Customizable Geographical Location Granularity
Open

Comments

  •  8
    Ying started the conversation

    Hi Dustin,

    I purchased the WPC Smart Notifications Plugin yesterday, and I'm very impressed with the powerful logic—I really like it. However, there are two common areas that need improvement about Data Source - "New Orders".

    1. Name Anonymization - Crucial 
    Currently, it displays the customer's real, full name. This can easily be perceived by consumers as an invasion of privacy and could potentially violate privacy laws in some countries (like the US or in Europe). Therefore, anonymization is essential. It would be best if the plugin offered users a choice among common display formats (using 'Jesse Stowe' as an example):
    ① Jesse S. (Most common)
    ② J. Stowe
    ③ Someone
    ④ Full Name

    If this improvement cannot be implemented quickly, would it be possible to provide me with a short piece of code? This snippet would override the default display and show the customer's name in the anonymized format, such as 'Jesse S.', so that I can confidently continue using the Data Source - "New Orders".

    2. Customizable City/Location Precision
    Currently, only the 'town / city' field value is displayed. Depending on the scenario, users might need the 'Country / Region' and/or 'Province / State' fields. For instance, users might need options such as:
    ① City, Province (For websites targeting a single country)
    ② Province, Country (For global websites)
    ③ City, Country (For global websites)
    ④ City (For websites targeting a single country)

    Best,
    Ying

  •  1,558
    Dustin replied

    Hi Ying,

    You can adjust the name and address by adding the custom code below. (How to add custom code? ↗):

    add_filter( 'WPCSN/new_orders/item_title', function ( $title, $name, $address, $order ) {
    	// adjust customer name
    	$first_name = $order->get_billing_first_name();
    	$last_name  = $order->get_billing_last_name();
    
    	if ( ! empty( $last_name ) ) {
    		$name = $first_name . ' ' . strtoupper( $last_name[0] ) . '.';
    	} else {
    		$name = $first_name;
    	}
    
    	// adjust customer address
    	$state   = $order->get_billing_state();
    	$city    = $order->get_billing_city();
    	$country = $order->get_billing_country();
    	$address = $city . ', ' . $state . ', ' . $country;
    
    	return sprintf( '%1$s from %2$s purchased a', '<strong>' . $name . '</strong>', '<strong>' . $address . '</strong>' );
    }, 99, 4 );

    Best regards,
    Dustin

  •  8
    Ying replied

    Great! Perfectly effective. Thanks!