Skip to content

Commit

Permalink
feat: declare add-on compatible with product editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinderk committed Dec 15, 2023
1 parent 865acc8 commit a3a9822
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions gateway-payfast.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* WC requires at least: 8.1
* Requires PHP: 7.3
*/
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;

defined( 'ABSPATH' ) || exit;

Expand Down Expand Up @@ -81,16 +80,29 @@ function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_
}

/**
* Declares support for HPOS.
* Declares compatibility with Woocommerce features.
*
* List of features:
* - custom_order_tables
* - product_block_editor
*
* @since x.x.x Rename function
* @return void
*/
function woocommerce_payfast_declare_hpos_compatibility() {
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
function woocommerce_payfast_declare_feature_compatibility() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
'custom_order_tables',
__FILE__
);

\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
'product_block_editor',
__FILE__
);
}
}
add_action( 'before_woocommerce_init', 'woocommerce_payfast_declare_hpos_compatibility' );
add_action( 'before_woocommerce_init', 'woocommerce_payfast_declare_feature_compatibility' );

/**
* Display notice if WooCommerce is not installed.
Expand Down

0 comments on commit a3a9822

Please sign in to comment.