commerce icon indicating copy to clipboard operation
commerce copied to clipboard

[3.x]: Unable to disable/modify purgeOrphanedCustomers

Open CMeldgaard opened this issue 3 years ago • 1 comments

What happened?

Just like the purgeIncompleteCarts has a purgeInactiveCarts settings, it would be nice if we could do the same to the purgeOrphanedCustomers function.

We have a shop where a company is assigned a customer, custom catalog etc, and that company then has multiple logins for each employee. So all employees are making a order on the same customer.

But the issue, is that the customer gets deleted because the company hasn't created a order yet. If i could disable the commerce function, then i can create my own GC function, similar to the one in commerce, but where it takes in consideration that some customers must be preserved.

The best would actually be to implement it the same way as the purgeOrphanedAddresses, because then we can still use the GC function, but just add our own extra where clauses

Craft CMS version

3.7.45.1

Craft Commerce version

3.4.15

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

CMeldgaard avatar Jun 24 '22 09:06 CMeldgaard

@nfourtythree is there any timeline for this enhancement ?

CMeldgaard avatar Sep 28 '22 11:09 CMeldgaard

We wont be changing the behavior of purging customers with no commerce data in 3.x - In 4.x we have removed the concept of customers altogether so we have removed craft\commerce\services\Customers::purgeOrphanedCustomers() etc.

Best to look at 4.0 and figure out your migration path with your business rules. Thanks.

lukeholder avatar Dec 06 '22 01:12 lukeholder