| 1 |
<?php |
| 2 |
/** |
| 3 |
* Add compatibility with WooCommerce (core) features. |
| 4 |
* |
| 5 |
* @since 1.5.0 |
| 6 |
* |
| 7 |
* @package woo-additional-terms |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace Woo_Additional_Terms\Compatibility; |
| 11 |
|
| 12 |
use Automattic\WooCommerce\Utilities\FeaturesUtil; |
| 13 |
|
| 14 |
/** |
| 15 |
* WooCommerce Compatibility class. |
| 16 |
*/ |
| 17 |
class WooCommerce { |
| 18 |
|
| 19 |
/** |
| 20 |
* Constructor method. |
| 21 |
* |
| 22 |
* @since 1.5.0 |
| 23 |
* |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
public function setup() { |
| 27 |
|
| 28 |
add_action( 'before_woocommerce_init', array( $this, 'add_block_editor_compatibility' ) ); |
| 29 |
add_action( 'before_woocommerce_init', array( $this, 'add_hpos_compatibility' ) ); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Declaring compatibility with product block editor. |
| 34 |
* |
| 35 |
* Despite being unrelated to the "Product Block Editor," |
| 36 |
* a compatibility flag has been added to prevent WooCommerce from labeling it as "uncertain." |
| 37 |
* |
| 38 |
* @since 1.6.0 |
| 39 |
* |
| 40 |
* @return void |
| 41 |
*/ |
| 42 |
public function add_block_editor_compatibility() { |
| 43 |
|
| 44 |
// Declare compatibility with product block editor. |
| 45 |
FeaturesUtil::declare_compatibility( 'product_block_editor', woo_additional_terms()->service( 'file' )->plugin_file() ); |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Declaring compatibility with HPOS. |
| 50 |
* |
| 51 |
* This plugin has nothing to do with "High-Performance Order Storage". |
| 52 |
* However, the compatibility flag has been added to avoid WooCommerce declaring the plugin as "uncertain". |
| 53 |
* |
| 54 |
* @since 1.5.0 |
| 55 |
* |
| 56 |
* @return void |
| 57 |
*/ |
| 58 |
public function add_hpos_compatibility() { |
| 59 |
|
| 60 |
// Declare compatibility with HPOS. |
| 61 |
FeaturesUtil::declare_compatibility( 'custom_order_tables', woo_additional_terms()->service( 'file' )->plugin_file() ); |
| 62 |
} |
| 63 |
} |
| 64 |
|