<?php
/**
 * wp-luxury WordPress Theme, ordasvit.com
 * wp-luxury is distributed under the terms of the GNU GPL
 * Copyright: OrdaSvit, Andrey Kvasnevskiy, ordasvit.com
 */

// add show attribute in product catalog
add_action( 'woocommerce_after_shop_loop_item', 'wp_luxury_add_attribute_amount_of_places', 5 );
function wp_luxury_add_attribute_amount_of_places (){
  global $product;
  

  $values = get_the_terms( $product->id, 'pa_amount-of-places');

  if(isset($values) && !empty($values) ) {

    if( isset($values->errors) ) return ;

     echo '<div class="product_attribute amount-of-places"> <i class="fas fa-users"></i>';

    foreach ( $values as $value ) {
      echo $value->name;
    }

    echo '</div>';

  }

}

add_action( 'woocommerce_after_shop_loop_item', 'wp_luxury_add_attribute_duration', 5 );
function wp_luxury_add_attribute_duration (){
  global $product;
  

  $values = get_the_terms( $product->id, 'pa_duration');

  if(isset($values) && !empty($values) ) {

    if( isset($values->errors) ) return ;

     echo '<div class="product_attribute duration"> <i class="fas fa-calendar-check"></i>';

    foreach ( $values as $value ) {
      echo $value->name;
    }

    echo '</div>';

  }

}