// Ajax обновление корзины
const ajaxUpdateCartContainer = document.querySelector('div.woocommerce');
if (ajaxUpdateCartContainer){
ajaxUpdateCartContainer.addEventListener('change', ({ target }) => {
target.closest('input.qty');
document.querySelector('[name="update_cart"]').click();
});
}
<section class="">
<div class="container">
<?php
$loop = new WP_Query( array(
'post_type' => 'product',
'posts_per_page' => 2+1,
'orderby' => 'menu_order',
'order' => 'ASC',
));
?>
<div class="woocommerce">
<ul class="products products_archive_grid">
<?
while ( $loop->have_posts() ): $loop->the_post();
$id = get_the_ID();
$short = do_shortcode('[product id="'.$id.'"]');
$short = str_replace(
"<div class=\"woocommerce \"><ul class=\"products products_archive_grid\">",
"",
$short);
$short = substr($short,0,-11);
echo $short;
endwhile;
?>
</ul>
</div>
</div>
</section>
$attributes = $product->get_attributes();
$content = '<ul class="custom-attributes">';
foreach ( $attributes as $attribute ) {
if ($attribute['is_taxonomy']) {
$values = wc_get_product_terms($product->id, $attribute['name'], array('fields' => 'names'));
$content .= '<li><span class="attribute-label-text">'.wc_attribute_label( $attribute['name'] ).'</span> : ';
$content .= apply_filters('woocommerce_attribute', implode(', ', $values), $attribute, $values);
$content .= '</li>';
}
}
$content .= '</ul>';
echo $content;
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">
<?php if ( $checkout->get_checkout_fields() ) : ?>
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
<div class="row" id="customer_details">
<div class="col-md-6">
<?php do_action( 'woocommerce_checkout_billing' ); ?>
</div>
<div class="col-md-6">
<?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
<h3 id="order_review_heading"><?php esc_html_e( 'Your order', 'woocommerce' ); ?></h3>
<p class="ti-0 h5 text-center pb-3" style="font-size: 15px">Чтобы рассчитать стоимость доставки укажите Ваш город</p>
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?>
<div id="order_review" class="woocommerce-checkout-review-order">
<?=woocommerce_order_review();?>
</div>
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
</div>
</div>
<?=woocommerce_checkout_payment();?>
<?php endif; ?>
</form>
<li>
<div class="address-field" data-priority="40">
<label for="billing_city" class="">Укажите город:
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text mt-1 m-0" id="demo1" name="billing_city">
</span>
</label>
</div>
<script>
$(document).ready(function() {
var b = $('#billing_city').val();
$('#demo1').attr('value', b);
});
$('#demo1').keyup(function() {
var a = $(this).val();
$('#billing_city').attr('value', a);
});
</script>
</li>