Update Block Checkout/Cart Logic
-
We were looking at the logic of how the plugin determines whether a cart/ or checkout/ page is using the Block experience, and we were wondering if you could update that logic to fall in line with core WooCommerce?
WooCommerce offers a way to check if a page includes Blocks through a helper in their plugin: https://github.com/woocommerce/woocommerce/blob/release/8.6/plugins/woocommerce/includes/blocks/class-wc-blocks-utils.php#L62-L84
Something along the lines of this for both the cart/ and checkout could work:
// Conditional function that check if Checkout page use Checkout Blocks
function is_checkout_block() {
return WC_Blocks_Utils::has_block_in_page( wc_get_page_id('checkout'), 'woocommerce/checkout' );
}Another approach could be using the CartCheckout Utilities:
- https://wp-kama.com/plugin/woocommerce/function/CartCheckoutUtils::is_cart_block_default
- https://wp-kama.com/plugin/woocommerce/function/CartCheckoutUtils::is_checkout_block_default
QUESTIONS/ASKS:
- Right now, we have a few sites using this plugin and also have Block Checkout and Cart enabled. But we are still seeing the traditional
wc_add_notice()
messaging shows up. - We also have the
Advanced Coupons for WooCommerce Premium
, but wanted to have the conversation here on (dot)org to surface the issue on the Free version. We’ve disabled all other plugins and stripped it down to core WordPress, WooCommerce, and theAdvanced Coupons for WooCommerce Free
plugin. - We’d like to allow the inline Error Messaging to show up when inputing a Coupon Code.
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.