$price = $product->get_sale_price();
$newPrice = $price / get_attribute('ваш атрибут');
echo $newPrice. " шт" ;
<div class="prod__tags">
<?php if ( !empty(woocommerce_show_product_loop_sale_flash()) ) : ?>
<?php woocommerce_show_product_loop_sale_flash(); ?>
<?php else : ?>
<?php endif; ?>
<?php if ( has_term('hit', 'product_tag') ) : ?>
<?php $tagz = get_term_by('slug', 'hit', 'product_tag'); ?>
<div class="prod__tags-item prod__tags-fire">
<span class="prod__tags-item-text"><?php echo $tagz->name; ?></span>
</div>
<?php endif; ?>
<?php if ( $product->is_on_sale() ) : ?>
<div class="prod__tags-item prod__tags-sale">
<?php echo apply_filters( 'woocommerce_sale_flash', '<span class="prod__tags-item-text">' . esc_html__( 'Скидка', 'woocommerce' ) . '</span>', $post, $product ); ?>
</div>
<?php endif;
<section class="section recommendations similar">
<div class="container recommendations_container">
<div class="content" style="padding: 0 15px;">
<div class="section_header">
<div class="recommendations_items">
<?php
$related = wc_get_related_products($product->get_id());
$loop = new WP_Query( array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'posts_per_page' => 99,
'columns' => 3,
'order' => 'rand',
'post__in' => $related,
'post__not_in' => array($product->get_id())
));
while ( $loop->have_posts() ): $loop->the_post(); ?>
<div class="recommendation">
<div <?php post_class("inloop-product"); ?>>
<div class="row">
<div class="col-sm-4">
<?php the_post_thumbnail("thumbnail-215x300"); ?>
</div>
<div class="col-sm-8">
<h4>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h4>
<?php the_content(); ?>
<p class="price">
<?php _e("Price:","examp"); ?>
<?php woocommerce_template_loop_price(); ?>
</p>
<?php woocommerce_template_loop_add_to_cart(); ?>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>
</div>
</div>
</div>
</div>
</section>
// для навигации на страницу объектов
function wp_corenavi() {
global $wp_query, $wp_rewrite;
$pages = '';
$max = $wp_query->max_num_pages;
if (!$current = get_query_var('paged')) $current = 1;
$a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999));
$a['total'] = $max;
$a['current'] = $current;
$total = 1; //1 - ВЫВОДИТЬ ТЕКСТ "СТРАНИЦА N ИЗ N", 0 - НЕ ВЫВОДИТЬ
$a['mid_size'] = 2; //СКОЛЬКО ССЫЛОК ПОКАЗЫВАТЬ СЛЕВА И СПРАВА ОТ ТЕКУЩЕЙ
$a['end_size'] = 1; //СКОЛЬКО ССЫЛОК ПОКАЗЫВАТЬ В НАЧАЛЕ И В КОНЦЕ
$a['prev_text'] = 'Назад'; //ТЕКСТ ССЫЛКИ "ПРЕДЫДУЩАЯ СТРАНИЦА"
$a['next_text'] = 'Дальше'; //ТЕКСТ ССЫЛКИ "СЛЕДУЮЩАЯ СТРАНИЦА"
if ($max > 1) echo '<div class="paginator">';
if ($total == 1 && $max > 1) $pages = '<span class="pages">Страница ' . $current . ' из ' . $max . '</span>'."\r\n";
echo $pages . paginate_links($a);
if ($max > 1) echo '</div>';
}
<?php
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'product_cat' => $term->slug
);
$products = new WP_Query( $args );
if ( $products->have_posts() ) :
?>
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
<!-- item -->
<?php
$attributes = $product->get_attributes();
foreach ( $attributes as $attribute ):
$attribute_data = $attribute->get_data(); // Get the data in an array
$attribute_name = $attribute_data['name']; // The taxonomy slug name
$attribute_terms = $attribute_data['options'][0]; // The terms Ids
// echo '<pre>'; print_r($attribute_terms); echo '</pre>';
if ($attribute_name == 'метка' & $attribute_terms == 'Новинки' ) {
wc_get_template_part( 'content', 'product' );
}
endforeach;
?>
<?php
/**
* Hook: woocommerce_after_single_product_summary.
*
* @hooked woocommerce_output_product_data_tabs - 10
* @hooked woocommerce_upsell_display - 15
* @hooked woocommerce_output_related_products - 20
*/
do_action( 'woocommerce_after_single_product_summary' );
?>
</div>
<?php do_action( 'woocommerce_after_single_product' ); ?>