// Lấy tất cả attribute của sản phẩm ngoại trừ trong if
add_shortcode('fv_tour_att','fv_tour_att');
function fv_tour_att() {
$output = '<ul style="list-style:none;">';
foreach( wc_get_attribute_taxonomies() as $attribute ) {
$taxonomy = 'pa_' . $attribute->attribute_name;
$term_names = get_terms( array( 'taxonomy' => $taxonomy, 'fields' => 'names' ) );
if( ($taxonomy == 'pa_duration') || ($taxonomy == 'pa_tour-type') || ($taxonomy == 'pa_travel-type') || ($taxonomy == 'pa_hotel') ){
}elseif($taxonomy == 'pa_included'){
$output .= '<li><strong>' . $attribute->attribute_label . ':</strong> ✔' . implode( ' ✔ ', $term_names ) . '</li>';
}elseif($taxonomy == 'pa_excluded'){
$output .= '<li><strong>' . $attribute->attribute_label . ':</strong> ❌' . implode( ' ❌ ', $term_names ) . '</li>';
}else{
$output .= '<li><strong>' . $attribute->attribute_label . ':</strong> ' . implode( ', ', $term_names ) . '</li>';
}
}
return $output . '</ul>';
}
// Lấy 1 attribute trong woo
add_shortcode('fv_tour_des','fv_tour_des');
function fv_tour_des( ) {
global $product;
$att = $product->get_attribute( 'pa_departure' );
return $att;
}
// Tạo nút mua ngay [muahang id="1"]
function create_muangay_button( $args, $content ) {
$content = '<div style="text-align:center"><a class="button fn" href="/?add-to-cart='.$args['id'].'">Mua Ngay</a> <a href="tel:0569198888" target="_self" class="button fv-button-hotline" style="border-radius:0px;">Call: 0569.19.8888</span> </a></div>';
return $content;
}
add_shortcode('muahang', 'create_muangay_button');