Closed billythekid closed 2 years ago
@billythekid 😬 I'm actually in the process of making them into Elements as they come with lots of features, it's just a lot of work to implement - it's in progress though!
In the meantime I can easily add a few events like the one you mention.
An alternative to this is I add the feature that allows you to "blacklist" emails from triggering the plugin?
Yeah I think that might be a good idea for non-devs too. That way they could prevent their own tests from screwing with the numbers.
It would definitely meet my use-case above.
Easy, leave it with me
Released in version 1.5.3 ✌️
You can add a comma separated list of emails under settings and they will be ignored.
Nice one, cheers!
Heya @mediabeastnz,
I'm still getting abandoned carts for blacklisted email addresses. Can you take a look please?
Some events would be super helpful for a client need that we have.
Manually adding emails to the blacklist isn't an option for our client, so we're hoping to build a an automated way for users to add their emails to a list (we'd build our own custom controllers / records to store the blocked emails).
If we had access to some events before save or email send, we could check our custom blacklist and prevent saving or sending from happening.
Wanted to see if this is something you've already made progress on, or if you're open to a possible PR (I "might" be able to free up some time at work).
Appreciate your plugin. Cheers!
It dawned on me that records emit events.
I'm going to attempt creating my own dynamic list of blocked emails and invalidate the AbandonedCart
record if exists in the list.
use mediabeastnz\abandonedcart\records\AbandonedCart as AbandonedCartRecord;
Event::on(
AbandonedCartRecord::class,
AbandonedCartRecord::EVENT_BEFORE_INSERT,
function (ModelEvent $event) {
// TODO invalidate if the record email
// matches our list of blocked emails.
$event->isValid = false;
}
);
I was wondering if we could maybe get a couple of events fired from the plugin, in particular when an AbandonedCart is
save()
d so that we can hook into this and prevent the save (or amend it)My particular use-case is that my automated testing of the checkout process on the production server is creating abandoned carts (because we're not completing them) and this is muddying the conversion numbers. Ideally I could listen to the onBeforeSave event for the test email address or whatever and prevent the abandoned cart being created.
I was thinking the abandoned cart models may have been elements and inherited this automatically but had a quick look in the code and see they're not.