Skip to content
Advertisement

Show message on WooCommerce cart and checkout page when cart contains backorder products

I currently have this code in functions.php in order to display a message on the checkout page saying the customer has backordered products in their cart:

JavaScript

What do I need to do to also have this same message display on the CART page? (Before going to Checkout).

Thanks in advance.

Advertisement

Answer

Note 1: I changed the code so that it works with 1 hook on both pages as opposed to using 2 different hooks


Note 2: Notice the use of the notice_type

wc_add_notice( __( $message, 'woocommerce' ), 'notice' ); opposite 'error'.

Ultimately, this is not an error


Note 3: optionally you can remove the ‘proceed_to_checkout’ button (code line is in comment, this doesn’t seem to apply here) (see note 2)

So you get:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement