I have a custom taxonomy for WooCommerce products, let's say the slug is city.
The goal of the code is to loop through the cart contents, and save the number of unique city taxonomy entries.
After that, the original price needs to be multiplied by the number of the counted all unique city taxonomies.
I managed to get to this code where it gets the taxonomy terms, but oblivious on what to do next:
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product_id = $cart_item['product_id'];
$term_names = wp_get_post_terms( $product_id, 'city', array('fields' => 'names') );}
Any advice would be greatly appreciated!