New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悶 Bug Report: WooCommerce PHP Notice for Payment gateway being de-activated in Cart and Checkout Blocks when Elementor is being used #20568
Comments
Hey @askwpgirl (Angela)! Nice to see you here! Thank you for submitting your issue! 馃檹 Please allow us some time to investigate it, and get back to you with our findings. 馃 Best regards |
Hi @askwpgirl and @nicholaszein, After researching this issue, the cause of this problem is the core of WooCommerce Block and you can use custom code below to solve this problem temporary if(!function_exists('lastudiokit__remove_object_class_filter')){
/**
*
* Remove Class Filter Without Access to Class Object
*
* @sources
* - https://gist.github.com/tripflex/c6518efc1753cf2392559866b4bd1a53#gistcomment-2823505
*
* @param string $tag Filter to remove
* @param string $class_name Class name for the filter's callback
* @param string $method_name Method name for the filter's callback
* @param int $priority Priority of the filter (default 10)
*
* @return bool Whether the function is removed.
*/
function lastudiokit__remove_object_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) {
if(empty($class_name) || empty($class_name) || empty($tag)){
return false;
}
global $wp_filter;
$is_hook_removed = false;
if ( ! empty( $wp_filter[ $tag ]->callbacks[ $priority ] ) ) {
$methods = array_filter(wp_list_pluck(
$wp_filter[ $tag ]->callbacks[ $priority ],
'function'
), function ($method) {
return is_string($method) || is_array($method);
});
$found_hooks = ! empty( $methods ) ? wp_list_filter( $methods, array( 1 => $method_name ) ) : array();
foreach( $found_hooks as $hook_key => $hook ) {
if ( ! empty( $hook[0] ) && is_object( $hook[0] ) && get_class( $hook[0] ) === $class_name ) {
$wp_filter[ $tag ]->remove_filter( $tag, $hook, $priority );
$is_hook_removed = true;
}
}
}
return $is_hook_removed;
}
}
add_action('woocommerce_init', function (){
if(is_admin() && (isset($_GET['action']) && $_GET['action'] === 'elementor')){
lastudiokit__remove_object_class_filter('wp_print_scripts', 'Automattic\WooCommerce\Blocks\Payments\Api', 'verify_payment_methods_dependencies', 1);
}
}); |
Yes, that's correct @choijun! You beat me to it! 馃挭 Thank you so much for providing the snippet above! 馃檹 This is awesome! 馃槂 @askwpgirl, this is not the only issue caused by the WooCommerce Blocks plugin. Unfortunately, they are pushing updates that break backward compatibility, and there are other cases, even with Gutenberg add-ons, where the WooCommerce Blocks plugin (which is embedded with WooCommerce) is applying methods that are breaking backward compatibility. I myself am having trouble using Brazilian-specific plugins because of the lack of backward compatibility in the checkout. This is likely something Elementor could come up with a patch for, but chances are that it would not be needed in a few months, as the development of WooCommerce Blocks evolves, and could totally break people's websites with a new WooCommerce release. For now, I will leave this bug report open. Kind regards |
Hey @nicholaszein - I got this message from WordPress today: |
Thanks @askwpgirl! This is very helpful! 馃檹 |
We have a very similar issue on our site triggered by using "Edit with Elementor" for the site's header on any site page. I can add the code above (thank you!) but I am not sure where to add the code. Could you please share where to edit the code? Thanks again! |
@preadored - Install the Code Snippets plugin by Code Snippets Pro - https://wordpress.org/plugins/code-snippets/ You can copy and paste that snippet into a new snippet. In Code Snippets, click Add New then paste the code and Save & Activate. |
Yes! 馃憦 worked like a charm, thank you so much! |
Any follow up to this issue? |
Please, any follow-ups? It really makes no sense to load things everywhere possible and to not have the possibility to unload it. For instance, we have a custom dashboard panel in wp-admin where we use our version on React. We do not use WP or Woo blocks and still, we can not unload React or blocks without doing so many workarounds. If anybody could point me in the right direction, I do not have an issue doing a PR. It is just really overwhelming to contribute to WP compared to other open-source projects. Thanks |
Prerequisites
Description
Editing any Elementor page results in the following PHP Notice to appear for each and every payment method on the site. For example:
Payment gateway with handle 'wc-payment-method-cheque' has been deactivated in Cart and Checkout blocks because its dependency 'wc-settings' is not registered. Read the docs about registering assets for payment methods: https://github.com/woocommerce/woocommerce-blocks/blob/060f63c04f0f34f645200b5d4da9212125c49177/docs/third-party-developers/extensibility/checkout-payment-methods/payment-method-integration.md#registering-assets
and
Payment gateway with handle 'wc-payment-method-cheque' has been deactivated in Cart and Checkout blocks because its dependency 'wc-blocks-registry' is not registered. Read the docs about registering assets for payment methods: https://github.com/woocommerce/woocommerce-blocks/blob/060f63c04f0f34f645200b5d4da9212125c49177/docs/third-party-developers/extensibility/checkout-payment-methods/payment-method-integration.md#registering-assets
Other people have been reporting similar issues via WooCommerce forums or the payment gateway forums not realizing it is an Elementor related issues.
I have de-activated all plugins except Elementor free version and WooCommerce. This started to occur after update to WooCommerce 7.x I believe. We updated in October, and it's been since then.
I am not seeing this on all Elementor/WooCommerce sites.
Here is another report:
https://wordpress.org/support/topic/error-in-elementor-3/
Steps to reproduce
I am able to replicate this on new staging site. Here is a Loom video:
https://www.loom.com/share/ad8eeed653d04e24b8b99b0d00da95d6
We are running PHP 7.4.
Isolating the problem
System Info
== Server Environment ==
Operating System: Linux
Software: nginx/1.18.0
MySQL version: mariadb.org binary distribution v10.3.16
PHP Version: 7.4.28
PHP Memory Limit: 256M
PHP Max Input Vars: 5000
PHP Max Post Size: 500M
GD Installed: Yes
ZIP Installed: Yes
Write Permissions: All right
Elementor Library: Connected
== WordPress Environment ==
Version: 6.1.1
Site URL: https://askwpgirldemo.sitedistrict.com
Home URL: https://askwpgirldemo.sitedistrict.com
WP Multisite: No
Max Upload Size: 500 MB
Memory limit: 768M
Max Memory limit: 768M
Permalink Structure: /%postname%/
Language: en-US
Timezone: Pacific/Honolulu
Admin Email: angela@askwpgirl.com
Debug Mode: Inactive
== Theme ==
Name: Hello Elementor
Version: 2.6.1
Author: Elementor Team
Child Theme: No
== User ==
Role: administrator
WP Profile lang: en_US
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
== Active Plugins ==
Elementor
Version: 3.8.1
Author: Elementor.com
== Must-Use Plugins ==
SiteDistrict Hosting SMTP
Version: 0.1.1
Author: SiteDistrict Team
== Elements Usage ==
== Elementor Experiments ==
Optimized DOM Output: Active
Improved Asset Loading: Active
Improved CSS Loading: Active
Inline Font Icons: Inactive
Accessibility Improvements: Active
Additional Custom Breakpoints: Active
Import Export Website Kit: Active
Hide native WordPress widgets from search results: Active by default
admin_menu_rearrangement: Inactive by default
Flexbox Container: Active
Hello Theme Header & Footer: Active
Landing Pages: Active by default
Color Sampler: Active by default
Favorite Widgets: Active by default
Admin Top Bar: Active by default
== Log ==
Log: showing 20 of 332022-11-01 08:29:37 [info] Elementor/Upgrades - _on_each_version Start
2022-11-01 08:29:37 [info] Elementor data updater process has been queued. [array (
'plugin' => 'Elementor',
'from' => '3.8.0-beta4',
'to' => '3.8.0',
)]
2022-11-01 08:29:37 [info] Elementor/Upgrades - _on_each_version Finished
2022-11-01 08:29:37 [info] Elementor/Upgrades - _v_3_8_0_fix_php8_image_custom_size Start
2022-11-01 08:29:37 [info] Elementor/Upgrades - _v_3_8_0_fix_php8_image_custom_size Finished
2022-11-01 08:29:37 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor',
'from' => '3.8.0-beta4',
'to' => '3.8.0',
)]
2022-11-13 14:01:44 [info] Elementor data updater process has been queued. [array (
'plugin' => 'Elementor',
'from' => '3.8.0',
'to' => '3.8.1',
)]
2022-11-13 14:01:45 [info] elementor::elementor_updater Started
2022-11-13 14:01:45 [info] Elementor/Upgrades - _on_each_version Start
2022-11-13 14:01:45 [info] Elementor/Upgrades - _on_each_version Finished
2022-11-13 14:01:45 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor',
'from' => '3.8.0',
'to' => '3.8.1',
)]
2022-11-14 10:55:35 [info] elementor-pro::elementor_pro_updater Started
2022-11-14 10:55:35 [info] Elementor Pro/Upgrades - _on_each_version Start
2022-11-14 10:55:35 [info] Elementor Pro/Upgrades - _on_each_version Finished
2022-11-14 10:55:35 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor Pro',
'from' => '3.8.0',
'to' => '3.9.0-beta1',
)]
2022-11-19 02:02:14 [info] elementor-pro::elementor_pro_updater Started
2022-11-19 02:02:14 [info] Elementor Pro/Upgrades - _on_each_version Start
2022-11-19 02:02:14 [info] Elementor Pro/Upgrades - _on_each_version Finished
2022-11-19 02:02:14 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor Pro',
'from' => '3.9.0-beta1',
'to' => '3.9.0-beta2',
)]
2022-11-19 02:02:15 [info] Elementor data updater process has been queued. [array (
'plugin' => 'Elementor Pro',
'from' => '3.9.0-beta1',
'to' => '3.9.0-beta2',
)]
PHP: showing 8 of 8PHP: 2022-11-01 08:29:37 [warning X 9][/www/wp-content/plugins/elementor/core/files/manager.php::111] unlink(/www/wp-content/uploads/elementor/css/min): Is a directory [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2022-11-01 08:54:02 [notice X 7][/www/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-url.php::34] Undefined offset: 1 [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2022-11-01 09:18:31 [notice X 34][/www/wp-content/plugins/elementor/modules/dev-tools/deprecation.php::304] The $control_id argument is deprecated since version 3.5.0! [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2022-11-01 09:18:32 [notice X 2][/www/wp-content/plugins/elementor/modules/dev-tools/deprecation.php::304] The $control_id argument is deprecated since version 3.5.0! [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> rest_error_handler()
#1: /www/wp-content/plugins/elementor/modules/dev-tools/deprecation.php(304): class type trigger_error()
#2: /www/wp-content/plugins/elementor/includes/managers/controls.php(523): Elementor\Modules\DevTools\Deprecation -> deprecated_argument()
#3: /www/wp-content/plugins/elementor/includes/managers/controls.php(501): Elementor\Controls_Manager -> register()
#4: /www/wp-content/plugins/dynamic-visibility-for-elementor/class/controls.php(48): Elementor\Controls_Manager -> register_control()
',
)]
PHP: 2022-11-01 09:24:59 [notice X 3][/www/wp-content/plugins/elementor/includes/conditions.php::90] Trying to access array offset on value of type null [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2022-11-01 09:30:40 [notice X 1][/www/wp-content/plugins/elementor/core/dynamic-tags/manager.php::73] Array to string conversion [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2022-11-14 11:01:57 [warning X 14][/www/wp-content/plugins/elementor/core/files/file-types/svg.php::191] SimpleXMLElement::__construct(): ^ [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2022-11-16 08:29:36 [error X 2][/www/wp-content/plugins/elementor/core/wp-api.php::26] Uncaught Error: Call to undefined function Elementor\Core\get_plugins() in /www/wp-content/plugins/elementor/core/wp-api.php:26
Stack trace:
#0 /www/wp-content/plugins/elementor/modules/compatibility-tag/base-module.php(96): Elementor\Core\Wp_Api->get_plugins()
#1 /www/wp-content/plugins/elementor/modules/compatibility-tag/base-module.php(58): Elementor\Modules\CompatibilityTag\Base_Module->get_plugins_with_header()
#2 /www/wp-content/plugins/elementor/modules/compatibility-tag/module.php(57): Elementor\Modules\CompatibilityTag\Base_Module->get_plugins_to_check()
#3 /www/wp-content/plugins/elementor/modules/compatibility-tag/base-module.php(148): Elementor\Modules\CompatibilityTag\Module->get_plugins_to_check()
#4 /www/wp-includes/class-wp-hook.php(307): Elementor\Modules\CompatibilityTag\Base_Module->Elementor\Modules\CompatibilityTag{closure}()
#5 /www/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#6 /www/wp-includes/plugin.php(476): WP_Hook->do_action()
#7 /www/wp-content/plugins/elementor/ [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
JS: showing 1 of 1JS: 2022-11-01 18:53:32 [error X 1][https://askwpgirldemo.sitedistrict.com/wp-admin/post.php?post=254952&action=elementor:3:22112] Cannot read properties of null (reading 'getBoundingClientRect')
== Elementor - Compatibility Tag ==
The text was updated successfully, but these errors were encountered: