Ultimately I am trying to add a field to checkout in woocommerce when a customer has over a certain quantity in their checkout. For this example I am using 500 and just trying to get a message to show at the bottom of checkout.
I have been trying various variations of code and this is what I have so far.
add_action( 'woocommerce_after_checkout_form', 'woocommerce_add_quantity_message', 12 );
function woocommerce_add_quantity_message() {
global $woocommerce;
$total_products = 0;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values )
{
$total_products += $values['quantity'];
}
if($total_products >=500 )
{
echo '<div class="card_discount_message"><p>MORE THAN 500 WOAHHHH</p></div>';
}
Any pointers would be greatly appreciated. I have also tried modifying the code found here with no luck woocommerce add fee to cart based on quantity