Can't delete Enterprises, Shipping Methods etc

We have obsolete data build-up. Need to work out how to clean this out and manage it going forward.


as logged on github

This is also an issue for super-admin, now clogging up with unneeded and unused enterprises

Suggested implementation / response (for both super-admin and enterprise owner . . managers CANNOT delete enterprises)

  • If Enterprise has NO products and NO orders associated with it, then it can be completely deleted

  • remove profile

  • disconnect shipping and payment methods

  • only if no other enterprises associated with shipping and payment methods, remove s/p methods too

  • remove fees

  • order cycles? just remove them - if no products / orders their inclusion has no meaning

  • what else do we need to think about?

  • if enterprise has products associated with it, but they have never been purchased, can do full delete - with warning that products will be removed

  • if Enterprise products have been purchased or there are orders associated with it (e.g. Hub), then ‘soft delete’ / ‘archive’ - we don’t want to remove from past reports, order cycles etc, but we do want to get them out of the way

    • hide from enterprise index page
    • hide e2e links [would removing them break anything? should we leave them but hide them from the views?]
    • hide from BPE
    • hide from Order Cycles interfaces

###Shipping Methods

  • As Superadmin, I need to be able to delete Shipping Methods, even if they have previously been used

Beyond the problem of being able to delete/archive entreprises, shipping methods, etc. that are linked to existing orders, etc.
I tried to delete today test hubs/order cycles we had created:

  • the hub Testblabla (no orders, order cycle, P2P relationship, products attached so we should be able to delete them)
  • the order cycle “meat test” (no order attached so we should be able to delete them)
    But in both case, we have “uncompleted orders” with a “cart status” meaning we have been on the shopfront I guess, so it has created an order with the status “cart”.
    And so we can’t delete them as well.