Update Block Checkout/Cart Logic | WordPress.org

[ad_1]

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:

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 the Advanced 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]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer