Remove shop on org delete

This commit is contained in:
Almira Krdzic
2018-10-19 20:00:40 +02:00
parent a5a795af93
commit 5d8e759e80
3 changed files with 25 additions and 1 deletions

View File

@@ -22,6 +22,8 @@ class Wiaas_Shop {
// create new shop if organization was assigned commercial lead role
// or remove shop if commercial lead role was removed for organization
add_action('wiaas_organization_roles_updated', array(__CLASS__, 'maybe_manage_shop_for_commercial_lead'), 10, 2);
add_action('wiaas_organization_deleted', array(__CLASS__, 'maybe_remove_shop'));
}
public static function get_shop_customers($owner_id) {
@@ -100,6 +102,15 @@ class Wiaas_Shop {
self::_maybe_remove_shop($owner_id);
}
/**
* Remove shop
*
* @param int $owner_id
*/
public static function maybe_remove_shop($owner_id) {
self::_maybe_remove_shop($owner_id);
}
/**
* Register special prices taxonomy to enable search of packages by prices inside every shop
*/
@@ -197,6 +208,8 @@ class Wiaas_Shop {
if ($attribute_id > 0) {
wc_delete_attribute($attribute_id);
}
Wiaas_Shop_DB::remove_shop($owner_id);
}
/**