| 1 |
<?php |
| 2 |
|
| 3 |
namespace StoreEngine\Hooks; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
class Integration { |
| 10 |
|
| 11 |
public static function init() { |
| 12 |
$self = new self(); |
| 13 |
add_action( 'storeengine/price_deleted', [ $self, 'remove_existing_integrations' ] ); |
| 14 |
} |
| 15 |
|
| 16 |
public function remove_existing_integrations( int $price_id ) { |
| 17 |
global $wpdb; |
| 18 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
| 19 |
$wpdb->delete( $wpdb->prefix . 'storeengine_integrations', [ 'price_id' => $price_id ], [ '%d' ] ); |
| 20 |
wp_cache_flush_group( \StoreEngine\Classes\Integration::CACHE_GROUP ); |
| 21 |
wp_cache_flush_group( \StoreEngine\Classes\AbstractProduct::CACHE_GROUP ); |
| 22 |
} |
| 23 |
|
| 24 |
} |
| 25 |
|