Remove shop on org delete
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user