This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
Error notice triggered when using Elementor editor #7907
Labels
block: checkout
Issues related to the checkout block.
type: bug
The issue/PR concerns a confirmed bug.
type: cooldown
Things that are queued for a cooldown period (assists with planning).
type: good first issue
The issue is a good candidate for the first community contribution/for a newcomer to the team.
Describe the bug
When using the Elementor post editor, the
woocommerce-blocks/src/Payments/Api.php
error_log message "Payment gateway with handle '%1$s' has been deactivated in Cart and Checkout blocks because its dependency '%2$s' is not registered." is triggered.To reproduce
Steps to reproduce the behavior:
Expected behavior
Editing a post using Elementor should not result in the script handles related to payments from being dequeued.
Environment
WordPress (please complete the following information):
Additional context
This error seems to occur because Elementor is not firing the
init
action when the Elementor post editor is opened. Inwoocommerce-blocks/src/AssetsController.php
theregister_assets
method is associated with theinit
action. That is where all blocks scripts are registered.In
woocommerce-blocks/src/Payments/Api.php
, there is the following line of code:add_action( 'wp_print_scripts', array( $this, 'verify_payment_methods_dependencies' ), 1 );
. When the wp_print_scripts function action is triggered, WooCommerce Blocks validates that all dependencies for a given payment method script handle are registered.However, if the
init
action is never fired, then none of the WooCommerce Blocks dependencies likewc-price-format
etc are registered which results in that error message.There should be some conditional check that ensures the verify_payment_methods_dependencies only executes if the init action has been run.
Example:
The text was updated successfully, but these errors were encountered: