Hi @xdekhckr ,
Thank you for sharing a 5 star review for the plugin. You’ve made my day.
You can hook into a filter that removes the name and email address as well as changes colours. Here’s a starter code snippet that will help achieve this – this can be added to your theme’s functions.php file.
If you have any other questions about this, please consider opening a support thread on this plugin’s forum and we can assist further from there.
add_filter( 'ppsndw_woo_discord_payload', function( $payload, $context ) {
if ( ! isset( $payload['embeds'][0] ) ) {
return $payload;
}
// --- Remove customer name and email fields ---
$fields_to_remove = array( 'Customer', 'Email' );
$payload['embeds'][0]['fields'] = array_values(
array_filter(
$payload['embeds'][0]['fields'],
function( $field ) use ( $fields_to_remove ) {
return ! in_array( $field['name'], $fields_to_remove, true );
}
)
);
// --- Override the embed colour per status ---
$custom_colors = array(
'completed' => 0x00b894, // teal
'processing' => 0x0984e3, // bright blue
'pending' => 0xfdcb6e, // yellow
'on-hold' => 0xe17055, // orange
'failed' => 0xd63031, // red
'cancelled' => 0xb2bec3, // light grey
'refunded' => 0x636e72, // dark grey
'new_customer'=> 0xa29bfe, // purple
);
$status = $context['status'];
if ( isset( $custom_colors[ $status ] ) ) {
$payload['embeds'][0]['color'] = $custom_colors[ $status ];
}
return $payload;
}, 10, 2 );
Yeah, thanks for info, I was just playing around and that was just my idea on how to make this plugin better and more customizable for everyone.