Jelly, Strawberry- Squeeze Bottle (Compared To Welch’s Strawberry Jelly)

$0.00

19 in stock

Description

function wph_add_the_cart_validation_for_zoomarine_e_ticket( $passed ) {
// The product id of variable product X
$product_id = 63;
$in_cart = false;

foreach( WC()->cart->get_cart() as $cart_item ) {
$product_in_cart = $cart_item[‘product_id’];
if ( $product_in_cart === $product_id ) $in_cart = true;
}

if ( $in_cart ) { ?>

alert(“The product is already in cart. You can only add one E ticket per order”);

<?php
$passed = false;
}
return $passed;
}

add_filter( 'woocommerce_add_to_cart_validation', 'wph_add_the_cart_validation_for_zoomarine_e_ticket', 10, 5 );