// делаешь копию
const copy = arr.concat();
// мутируешь копию
let filtered = copy.filter(category => {
category.items = category.items.filter(item => {
return item.keywords.some(keyword => keyword.includes(filter))
})
return category.items.length
})
<div class="row">
<div class="col-xs-7 col-sm-7 col-md-7 col-lg-7">
col-7
</div>
<div class="col-xs-7 col-sm-7 order-sm-1 col-md-7 col-lg-7">
col-7
</div>
<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5">
col-5
</div>
</div>
<div class="row justify-content-between">
<div class="col-lg-5"></div>
<div class="col-lg-5"></div>
</div>
function krona_filter_wpcf7_posted_data( $posted_data ) {
// make filter magic happen here...
if( isset( $posted_data['your-cart'] ) ) {
$posted_data['your-cart'] = "<span style='color: green; text-style: italic;'>здесь будет информация о товарах</span>";
}
return $posted_data;
};
add_filter( 'wpcf7_posted_data', 'krona_filter_wpcf7_posted_data', 10, 1 );
$count = WC()->cart->get_cart_contents_count();
if( isset( $posted_data['your-cart'] ) ) {
$posted_data['your-cart'] = "<span style='color: green; text-style: italic;'>всего товаров в корзине" . $count . "</span>";
}
$("#wpcf7-f44-o5 .wpcf7-submit").on('click', function(e) {
e.preventDefault();
var $form = $(this.form);
var $cart = $('#side_cart');
var quantity = '<div>Товаров в корзине: ' + $cart.data('count') + ' шт.</div>';
var price = '<div>На сумму: ' + $cart.data('total') + ' руб.</div>';
var info = $cart.find('.js-side-cart-item').map(function(i, el) {
var $item = $(el);
return "<div>" + $item.data('name') + ", цена " + $item.data('price') + " руб, кол-во " + $item.data('quantity') + " шт.</div>";
}).get().join('');
$form.find('[name="your-cart"]').val('<div>Корзина</div>' + quantity + price + info + '</div>');
$form.trigger('submit');
});
<?php
/**
* The template for displaying product content in the single-product.php template
*
* This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.6.0
*/
defined( 'ABSPATH' ) || exit;
global $product;
/**
* Hook: woocommerce_before_single_product.
*
* @hooked wc_print_notices - 10
*/
do_action( 'woocommerce_before_single_product' );
if ( post_password_required() ) {
echo get_the_password_form(); // WPCS: XSS ok.
return;
}
?>
<div id="product-<?php the_ID(); ?>" <?php wc_product_class( '', $product ); ?>>
<div class="container">
<div class="row">
<!-- это галерея что слева -->
<div class="col-lg-6">
<?php
/**
* Hook: woocommerce_before_single_product_summary.
*
* @hooked woocommerce_show_product_sale_flash - 10
* @hooked woocommerce_show_product_images - 20
*/
do_action( 'woocommerce_before_single_product_summary' );
?>
</div>
<!-- это summary товара -->
<div class="col-lg-3">
<div class="summary entry-summary">
<?php
/**
* Hook: woocommerce_single_product_summary.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
* @hooked WC_Structured_Data::generate_product_data() - 60
*/
do_action( 'woocommerce_single_product_summary' );
?>
</div>
</div>
<!-- здесь будет содержимое третьей колонки -->
<div class="col-lg-3">
</div>
</div>
</div>
<!-- это уже табы, кросселы и апселы -->
<div class="container">
<?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>
</div>
<?php do_action( 'woocommerce_after_single_product' ); ?>