File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " medusa-plugin-sendgrid-typescript" ,
3- "version" : " 2.2.1 " ,
3+ "version" : " 2.2.2 " ,
44 "description" : " SendGrid transactional emails typescript" ,
55 "repository" : {
66 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -297,6 +297,17 @@ export class SendGridService extends AbstractNotificationService {
297297 attachmentGenerator
298298 )
299299
300+ const toBcc = ( ) => {
301+ if ( this . options_ . orderPlacedBcc && event === "order.placed" ) {
302+
303+ if ( this . options_ ?. noSendCountries && this ?. options_ ?. noSendCountries . includes ( data . order ?. shipping_address ?. country_code ) ) {
304+ return undefined
305+ }
306+ return this . options_ . orderPlacedBcc
307+ }
308+ return undefined
309+ }
310+
300311 const sendOptions : SendGrid . MailDataRequired = {
301312 templateId : templateId ,
302313 from : this . options_ . from ,
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ export interface PluginOptions {
3535 templates : Templates
3636 /** BCC email address to send to when an order is placed. */
3737 orderPlacedBcc ?: EmailData | EmailData [ ]
38+ /** BCC email address to send to when an order is canceled. */
39+ noSendCountries ?: string [ ]
3840 /** locale as key example de-DE */
3941 localization : {
4042 [ key : string ] : Templates
You can’t perform that action at this time.
0 commit comments