'order' => 'DESC',
'orderby' => 'meta_value_num',
'meta_query' => [
[
'relation' => 'OR',
array(
'key' => '_thumbnail_id',
'compare' => 'NOT EXISTS'
],
[
'key' => '_thumbnail_id',
'compare' => '!NOT EXISTS'
]
]
$out = '';
$html = <<<HTML
<tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--%s">
<th class="woocommerce-product-attributes-item__label">%s</th>
<td class="woocommerce-product-attributes-item__value">%s</td>
</tr>
HTML;
$i = 1;
foreach ( $product_attributes as $attribute ):
$attribute_data = $attribute->get_data();
if ( $i !== 3 ) {
$out .= sprintf( $html, esc_attr( $attribute_data['name'] ), wc_attribute_label( $attribute_data['name'], $product->get_attribute( $attribute_data['name'] ) ) );
} else {
printf( $html, esc_attr( $attribute_data['name'] ), wc_attribute_label( $attribute_data['name'], $product->get_attribute( $attribute_data['name'] ) ) );
}
$i ++;
endforeach;
echo $out;
if ( have_posts() ) : $n = 1;
while ( have_posts() ) : the_post();
$template = 1 === $n ? 'big' : 'small';
if ( 1 === $n ) {
echo '<div class="row"><div class="col-lg-6">';
}
if ( 2 === $n ) {
echo '<div class="col-lg-6">';
}
get_template_part( 'templates/post', $template );
if ( 3 === $n ) {
echo '</div>'; //<div class="col-lg-6"> - close $n = 2
}
if ( 1 === $n ) {
echo '</div>'; //<div class="col-lg-6"> - close $n = 1
}
if ( 3 === $n ) {
echo '</div>'; //<div class="row"> - close $n = 1
}
$n ++;
endwhile;
else :
endif;
WC()->cart->add_to_cart( $product_id );
$product_cart_id = WC()->cart->generate_cart_id( $product_id );
$in_cart = WC()->cart->find_product_in_cart( $product_cart_id );
function wpp_change_wc_block() {
global $post;
if ( has_term( [ $term_1_ID, $term_2_ID ], 'product_cat', $post ) ) {
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs', 6 );
}
}
add_action( 'init', 'pp_change_wc_block' );