Fix CheckoutWC implementation #33
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Greetings!
We've recently noticed that the simple turnstile plugin isn't working alongside CheckoutWC, We've had quite a few of our merchants use your plugin alongside ours for sometime, so it would be great if we could get it back up and working again.
We were able to take a look on our local test sites this morning and noticed that there was an update done in December which added WooCommerce Block checkout support. Unfortunately, this code seems to be the culprit of the issue our CheckoutWC merchants are experiencing. When loading the CheckoutWC checkout page, an uncaught JS exception is thrown which breaks the rest of the checkout page. The exception comes from the new code that was added for blocks, specifically, when trying to use turnstile to render (inside the (
wp && wp.data) conditional block) the HTML DOM element is not yet on the page, and as it's trying to read from the HTML element dataset on page load without any safety checks, it's causing the exception.We noticed that you have some compatibility code for CheckoutWC in your plugin, and it looks to be currently using the
cfw_after_cart_summary_totalshook. By moving this tocfw_checkout_payment_method_tabon priority 50, we were able to resolve the issue.Please let me know if you have any questions.