<?php
/**
 * WooCommerce feature compatibility declarations.
 *
 * Must load from the main plugin file before WooCommerce initializes.
 *
 * @package PhoenixWP\PriceLabels
 */

defined( 'ABSPATH' ) || exit;

add_action(
	'before_woocommerce_init',
	static function (): void {
		if ( ! class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
			return;
		}

		$plugin_file = PHOENIX_PRICE_LABELS_FOR_WOOCOMMERCE_FILE;

		$compatible_features = array(
			'custom_order_tables',
			'cart_checkout_blocks',
			'product_block_editor',
			'abandoned_cart_recovery',
		);

		foreach ( $compatible_features as $feature_id ) {
			\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( $feature_id, $plugin_file, true );
		}
	}
);
