Cart and Checkout Block Action Hooks
-
I am using the new cart and checkout blocks. Previously I was using the ‘woocommerce_before_cart’ and ‘woocommerce_before_checkout_form’ hooks to display a message. It appears those don’t work anymore. What are the new hooks called to do this?
-
Hi @thekendog
The new Cart and Checkout blocks in WooCommerce are built using JavaScript and React, and they do not support PHP hooks like
woocommerce_before_cart
andwoocommerce_before_checkout_form
. Instead, they use JavaScript events and filters. Currently, there is no direct equivalent for these hooks. However, you can find all the available hooks here: https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce-blocks/docs/third-party-developers/extensibility/hooksAs a temporary workaround, you can use classic checkout and cart block or the shortcode. More info: https://woocommerce.com/document/cart-checkout-blocks-status/
For reference, this particular forum is meant for general support with the core functionality of WooCommerce itself. For development and custom coding questions, it’s best to ask for insight related to those on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question.
I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.
Bummer.
Hi @thekendog,
Bummer
I understand how dissapointed you may feel, but as my colleague had shared above you can chooze to use the classic checkout and cart block or the shortcode. More info: https://woocommerce.com/document/cart-checkout-blocks-status/
I hope this helps you achieve your desired goals.
All the best.
Yeah, I know. Just frustrating the direction the plugin (and WordPress for that matter) is going. What used to be an easy PHP thing is now a complex javascript thing.
Hi @thekendog,
Please keep in mind that those are new features, and we’re working on them, you can continue to use the classic shortcodes as mentioned before in the meantime. Kindly know that we value your feedback, and we use it to improve our products in the future, considering ease of use and customization. That is the goal! 🙂
For instance, with Blocks, we’re focusing on visual building and options within the blocks themselves so it is way way easier for users to manage!
Thanks!
-OPHi @omarfpg
any thought on this please:
https://wordpress.org/support/topic/block-based-cart/
ThanksHello Make carlos,
Thank you for your message here.
It looks like you have a response to your topic.
You can continue the conversation over there.
This way we can keep the forum organized and follow the forum guidelines.Appreciate your cooperation.
Best regards.
Hi @doublezed2
Thanks and i can understand but there is no document where we can have filter hooks to get the result. there is no hook for block based cart ?
Can’t find out any proper document where to startHey,@make-carlos!
As per forum guidelines and to keep things organized, please reply on your thread so we can continue to assist you further there🙂
Have a wonderful day!
I am also having the same issue, where can i find hooks and actions for block based checkout ?
ThanksHi there!
The new Cart and Checkout blocks in WooCommerce are built using JavaScript and React, and they do not support PHP hooks likewoocommerce_before_cart
andwoocommerce_before_checkout_form
. Instead, they use JavaScript events and filters. You can use filter to customize the cart and checkout block page,for more details youu can use this article. https://developer.woocommerce.com/docs/cart-and-checkout-filters-cart-line-items/.For more details I would suggest you read the reply given by my colleauge @shameemreza at the top of this thread.
Thank you-
This reply was modified 4 months, 3 weeks ago by
shahzeen(woo-hc).
-
This reply was modified 4 months, 3 weeks ago by
- You must be logged in to reply to this topic.