Custom check out notice

PHOTO EMBED

Mon May 29 2023 10:28:52 GMT+0000 (Coordinated Universal Time)

Saved by @dawidofski

add_action( 'woocommerce_before_cart', 'cwpai_woo_cod_cart_notice' );
add_action( 'woocommerce_before_checkout_form', 'cwpai_woo_cod_cart_notice' );
function cwpai_woo_cod_cart_notice() {
    if ( WC()->cart->get_cart_contents_count() < 5 && WC()->session->get( 'chosen_payment_method' ) === 'cod' ) {
        wc_print_notice( 'You must have at least 5 items in your cart to use COD payment method.', 'notice' );
    }
}
content_copyCOPY

https://codewp.ai/replacing-woocommerce-plugins-with-ai-generated-code-snippets/