对客户存储库使用追加销售时禁用流规则



我正在通过调用的插件导入客户

$this->customerRepository->upsert([$newUser], Context::createDefaultContext());

当运行这行代码时,Shopware 6会尝试向客户发送电子邮件。

我想这是因为一个流动规则。

在我的情况下,禁止发送电子邮件的最佳方法是什么?

您可以将skipTriggerFlow状态添加到上下文中,这样就不会触发流。

$context = Context::createDefaultContext();
$context->addState(Context::SKIP_TRIGGER_FLOW);
$this->customerRepository->upsert([$newUser], $context);

这应该会停用对该上下文执行的所有操作的流执行。

最新更新