This code currently works to clear cart before adding a product to cart.
// Empty cart when product is added to cart, so we can't have multiple products in cart
add_action( 'woocommerce_add_cart_item_data', function( $cart_item_data ) {
wc_empty_cart();
return $cart_item_data;
} );
However I'm having trouble with making it product specific.
I'd like it to function as - if product ID#1 is added to cart, empty cart then add product (at whatever quantity).
How can I determine via the woocommerce_add_cart_item_data hook which product is added to the cart?