Answer the question
In order to leave comments, you need to log in
What causes carousel to break after woocommerce update?
On the product pages, the block "You may also be interested" is displayed. Block elements are placed in ul after woocommerce update, what could it be?
The block is generated by this code
<section class="main__catalog">
<div class="container">
<div class="section__title">Вам так же может быть интересно</div>
<div class="main__catalog-wrap main__catalog-slider">
<?
prosokol_related_products();
?>
</div>
</div>
</section>
function prosokol_related_products( $args = array() ) {
global $product;
if ( ! $product ) {
return;
}
$defaults = array(
'posts_per_page' => 5,
'columns' => 2,
'orderby' => 'rand', // @codingStandardsIgnoreLine.
'order' => 'desc',
);
$args = wp_parse_args( $args, $defaults );
// Get visible related products then sort them at random.
$args['related_products'] = array_filter( array_map( 'wc_get_product', wc_get_related_products( $product->get_id(), $args['posts_per_page'], $product->get_upsell_ids() ) ), 'wc_products_array_filter_visible' );
// Handle orderby.
$args['related_products'] = wc_products_array_orderby( $args['related_products'], $args['orderby'], $args['order'] );
// Set global loop values.
wc_set_loop_prop( 'name', 'related' );
wc_set_loop_prop( 'columns', apply_filters( 'woocommerce_related_products_columns', $args['columns'] ) );
wc_get_template( 'template-parts/related.php', $args );
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question