From f6be020240ed36d35c886a2a2ed51cfaeb31373b Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 13 Nov 2024 14:06:09 -0300 Subject: [PATCH] feat: register hook add_meta_boxes in the correct order --- plugin/webpay-rest.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/plugin/webpay-rest.php b/plugin/webpay-rest.php index b99083d..ddde01a 100644 --- a/plugin/webpay-rest.php +++ b/plugin/webpay-rest.php @@ -45,10 +45,11 @@ $hposExists = $hposHelper->checkIfHposExists(); add_action('plugins_loaded', 'registerPaymentGateways', 0); -add_action('wp_loaded', function () use ($hposExists) { - woocommerceTransbankInit($hposExists); -}); +add_action('wp_loaded', 'woocommerceTransbankInit'); add_action('admin_init', 'on_transbank_rest_webpay_plugins_loaded'); +add_action('add_meta_boxes', function () use ($hposExists) { + addTransbankStatusMetaBox($hposExists); +}); add_action('init', function() { add_action('wp_ajax_check_connection', ConnectionCheck::class . '::check'); @@ -113,7 +114,7 @@ function (Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_ } }); -function woocommerceTransbankInit(bool $hposExists) +function woocommerceTransbankInit() { if (!class_exists('WC_Payment_Gateway')) { noticeMissingWoocommerce(); @@ -122,7 +123,6 @@ function woocommerceTransbankInit(bool $hposExists) registerAdminMenu(); registerPluginActionLinks(); - registerMetaBoxes($hposExists); NoticeHelper::registerNoticesDismissHook(); NoticeHelper::handleReviewNotice(); } @@ -177,13 +177,6 @@ function registerPluginActionLinks() }); } -function registerMetaBoxes(bool $hPosExists) -{ - add_action('add_meta_boxes', function () use ($hPosExists) { - addTransbankStatusMetaBox($hPosExists); - }); -} - function addTransbankStatusMetaBox(bool $hPosExists) { if ($hPosExists) {