Anton | fix: настройка cart checkout
This commit is contained in:
@@ -292,6 +292,7 @@ function twentytwentyfour_test1_assets() {
|
||||
$css_file = ABSPATH . 'index3.css';
|
||||
$js_file = ABSPATH . 'index3.js';
|
||||
$checkout_css_file = get_theme_file_path( 'assets/css/test1-checkout.css' );
|
||||
$checkout_js_file = get_theme_file_path( 'assets/js/test1-checkout.js' );
|
||||
|
||||
if ( is_page( 'test1' ) ) {
|
||||
wp_dequeue_style( 'global-styles' );
|
||||
@@ -346,5 +347,462 @@ function twentytwentyfour_test1_assets() {
|
||||
(string) filemtime( $checkout_css_file )
|
||||
);
|
||||
}
|
||||
|
||||
if ( ( ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) || ( function_exists( 'is_cart' ) && is_cart() ) ) && file_exists( $checkout_js_file ) ) {
|
||||
wp_enqueue_script(
|
||||
'twentytwentyfour-test1-checkout-script',
|
||||
get_theme_file_uri( 'assets/js/test1-checkout.js' ),
|
||||
array(),
|
||||
(string) filemtime( $checkout_js_file ),
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'twentytwentyfour-test1-checkout-script',
|
||||
'test1CheckoutData',
|
||||
array(
|
||||
'freeShippingThreshold' => twentytwentyfour_water_delivery_free_shipping_threshold(),
|
||||
'catalogUrl' => home_url( '/test1/#catalog' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'twentytwentyfour_test1_assets', 100 );
|
||||
|
||||
/**
|
||||
* Free shipping threshold for custom notices.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_free_shipping_threshold() {
|
||||
return (float) apply_filters( 'twentytwentyfour_water_delivery_free_shipping_threshold', 1000 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Bottle deposit fee when no exchange is selected.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_deposit_fee() {
|
||||
return (float) apply_filters( 'twentytwentyfour_water_delivery_deposit_fee', 250 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a dedicated SEO plugin is active.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function twentytwentyfour_has_seo_plugin() {
|
||||
return defined( 'WPSEO_VERSION' ) || defined( 'RANK_MATH_VERSION' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get long-form SEO text for cart and checkout pages.
|
||||
*
|
||||
* @param string $context Page context.
|
||||
* @return string
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_seo_copy( $context ) {
|
||||
if ( 'checkout' === $context ) {
|
||||
return 'Оформление заказа воды в Севастополе должно быть быстрым и понятным, особенно когда вода нужна домой или в офис без лишних звонков и долгих подтверждений. На этой странице вы можете за несколько минут завершить заказ воды 19 литров, питьевой и минеральной воды, указать удобный адрес и выбрать подходящий способ оплаты. Мы доставляем воду в Гагаринский район, Ленинский район, Нахимовский район, Балаклаву и другие части города, поэтому оформить доставку питьевой воды можно в удобном для вас формате. Если вам нужна вода на дом в Севастополе для семьи, кухни или кулера, просто проверьте состав заказа и заполните контакты. Для компаний и коммерческих объектов доступен заказ воды в офис с подтверждением интервала и возможностью безналичной оплаты. Такой сценарий помогает быстро заказать воду 19 литров с доставкой, избежать ошибок в адресе и сразу передать нам всю информацию по подъезду, этажу и таре. Мы стараемся сделать оформление заказа удобным, чтобы доставка воды Севастополь воспринималась как простой сервис на каждый день, а не как долгий процесс с лишними шагами.';
|
||||
}
|
||||
|
||||
return 'Корзина на сайте доставки воды в Севастополе помогает быстро проверить состав заказа перед оформлением и убедиться, что в нем уже есть все нужные позиции: вода 19 литров, питьевая вода для кухни, минеральная вода для гостей, офиса или коммерческого помещения. Здесь можно изменить количество бутылей, удалить лишние товары и сразу увидеть итоговую сумму, стоимость доставки и дополнительные условия заказа. Такой формат особенно удобен для клиентов, которым нужна вода на дом в Севастополе без долгого оформления и повторных уточнений по телефону. Если вы заказываете доставку питьевой воды регулярно, корзина позволяет быстро собрать привычный набор и сразу перейти к следующему шагу. Мы доставляем заказы по Гагаринскому району, Ленинскому району, Нахимовскому району, Балаклаве и другим частям города, поэтому заказать воду 19 литров или дополнительные товары для кулера можно в одном месте. Перед оформлением вы можете проверить объем воды, количество бутылей и итоговую стоимость, а затем перейти на страницу подтверждения заказа. Такой подход делает доставку воды Севастополь удобной и понятной как для частных клиентов, так и для офисов, кафе, салонов и небольших компаний.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Output progress indicator for cart and checkout pages.
|
||||
*
|
||||
* @param string $current Current step.
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_progress_markup( $current ) {
|
||||
$steps = array(
|
||||
'cart' => __( 'Корзина', 'twentytwentyfour' ),
|
||||
'checkout' => __( 'Оформление', 'twentytwentyfour' ),
|
||||
'done' => __( 'Готово', 'twentytwentyfour' ),
|
||||
);
|
||||
?>
|
||||
<div class="checkout-progress" aria-label="<?php esc_attr_e( 'Прогресс оформления заказа', 'twentytwentyfour' ); ?>">
|
||||
<?php foreach ( $steps as $step_key => $label ) : ?>
|
||||
<?php
|
||||
$classes = 'checkout-progress-step';
|
||||
if ( $step_key === $current ) {
|
||||
$classes .= ' is-active';
|
||||
} elseif ( 'cart' === $current && 'done' !== $step_key ) {
|
||||
$classes .= ' is-pending';
|
||||
} elseif ( 'checkout' === $current && 'done' === $step_key ) {
|
||||
$classes .= ' is-pending';
|
||||
} else {
|
||||
$classes .= ' is-complete';
|
||||
}
|
||||
?>
|
||||
<span class="<?php echo esc_attr( $classes ); ?>"><span><?php echo esc_html( $label ); ?></span></span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Add and reorder checkout fields for local delivery.
|
||||
*
|
||||
* @param array $fields Checkout fields.
|
||||
* @return array
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_checkout_fields( $fields ) {
|
||||
unset( $fields['billing']['billing_company'], $fields['billing']['billing_postcode'] );
|
||||
|
||||
if ( isset( $fields['billing']['billing_city'] ) ) {
|
||||
$fields['billing']['billing_city']['default'] = __( 'Севастополь', 'twentytwentyfour' );
|
||||
$fields['billing']['billing_city']['required'] = true;
|
||||
$fields['billing']['billing_city']['priority'] = 45;
|
||||
$fields['billing']['billing_city']['custom_attributes'] = array( 'readonly' => 'readonly' );
|
||||
$fields['billing']['billing_city']['label'] = __( 'Город', 'twentytwentyfour' );
|
||||
$fields['billing']['billing_city']['class'] = array( 'form-row-first' );
|
||||
}
|
||||
|
||||
if ( isset( $fields['billing']['billing_first_name'] ) ) {
|
||||
$fields['billing']['billing_first_name']['priority'] = 10;
|
||||
$fields['billing']['billing_first_name']['label'] = __( 'Имя', 'twentytwentyfour' );
|
||||
}
|
||||
|
||||
if ( isset( $fields['billing']['billing_phone'] ) ) {
|
||||
$fields['billing']['billing_phone']['priority'] = 20;
|
||||
$fields['billing']['billing_phone']['required'] = true;
|
||||
$fields['billing']['billing_phone']['label'] = __( 'Телефон', 'twentytwentyfour' );
|
||||
$fields['billing']['billing_phone']['placeholder'] = '+7 (___) ___-__-__';
|
||||
}
|
||||
|
||||
if ( isset( $fields['billing']['billing_address_1'] ) ) {
|
||||
$fields['billing']['billing_address_1']['priority'] = 50;
|
||||
$fields['billing']['billing_address_1']['label'] = __( 'Улица', 'twentytwentyfour' );
|
||||
$fields['billing']['billing_address_1']['placeholder'] = __( 'Улица и район доставки', 'twentytwentyfour' );
|
||||
$fields['billing']['billing_address_1']['class'] = array( 'form-row-wide', 'has-address-autofill' );
|
||||
}
|
||||
|
||||
$fields['billing']['billing_house'] = array(
|
||||
'label' => __( 'Дом', 'twentytwentyfour' ),
|
||||
'required' => true,
|
||||
'class' => array( 'form-row-first' ),
|
||||
'priority' => 55,
|
||||
);
|
||||
|
||||
$fields['billing']['billing_flat'] = array(
|
||||
'label' => __( 'Квартира', 'twentytwentyfour' ),
|
||||
'required' => false,
|
||||
'class' => array( 'form-row-last' ),
|
||||
'priority' => 56,
|
||||
);
|
||||
|
||||
$fields['billing']['billing_entrance_floor'] = array(
|
||||
'label' => __( 'Подъезд / этаж', 'twentytwentyfour' ),
|
||||
'required' => false,
|
||||
'class' => array( 'form-row-wide' ),
|
||||
'priority' => 57,
|
||||
);
|
||||
|
||||
$fields['order']['tw_delivery_day'] = array(
|
||||
'type' => 'select',
|
||||
'label' => __( 'Когда доставить', 'twentytwentyfour' ),
|
||||
'required' => true,
|
||||
'class' => array( 'form-row-first' ),
|
||||
'priority' => 15,
|
||||
'options' => array(
|
||||
'' => __( 'Выберите день', 'twentytwentyfour' ),
|
||||
'today' => __( 'Сегодня', 'twentytwentyfour' ),
|
||||
'tomorrow' => __( 'Завтра', 'twentytwentyfour' ),
|
||||
),
|
||||
);
|
||||
|
||||
$fields['order']['tw_delivery_time'] = array(
|
||||
'type' => 'select',
|
||||
'label' => __( 'Интервал времени', 'twentytwentyfour' ),
|
||||
'required' => true,
|
||||
'class' => array( 'form-row-last' ),
|
||||
'priority' => 16,
|
||||
'options' => array(
|
||||
'' => __( 'Выберите интервал', 'twentytwentyfour' ),
|
||||
'08-12' => '08:00-12:00',
|
||||
'12-16' => '12:00-16:00',
|
||||
'16-20' => '16:00-20:00',
|
||||
),
|
||||
);
|
||||
|
||||
$fields['order']['tw_bottle_exchange'] = array(
|
||||
'type' => 'select',
|
||||
'label' => __( 'Возврат тары', 'twentytwentyfour' ),
|
||||
'required' => true,
|
||||
'class' => array( 'form-row-wide' ),
|
||||
'priority' => 17,
|
||||
'options' => array(
|
||||
'exchange' => __( 'Есть обмен пустой тары', 'twentytwentyfour' ),
|
||||
'no_exchange' => __( 'Нужна новая тара, добавить залог', 'twentytwentyfour' ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( isset( $fields['order']['order_comments'] ) ) {
|
||||
$fields['order']['order_comments']['priority'] = 20;
|
||||
$fields['order']['order_comments']['label'] = __( 'Комментарий', 'twentytwentyfour' );
|
||||
$fields['order']['order_comments']['placeholder'] = __( 'Комментарий к доставке, ориентир, код домофона', 'twentytwentyfour' );
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
add_filter( 'woocommerce_checkout_fields', 'twentytwentyfour_water_delivery_checkout_fields' );
|
||||
|
||||
/**
|
||||
* Store bottle exchange choice in session during checkout refresh.
|
||||
*
|
||||
* @param string $posted_data Serialized checkout payload.
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_update_order_review( $posted_data ) {
|
||||
parse_str( $posted_data, $data );
|
||||
|
||||
if ( isset( $data['tw_bottle_exchange'] ) && WC()->session ) {
|
||||
WC()->session->set( 'tw_bottle_exchange', sanitize_text_field( wp_unslash( $data['tw_bottle_exchange'] ) ) );
|
||||
}
|
||||
}
|
||||
add_action( 'woocommerce_checkout_update_order_review', 'twentytwentyfour_water_delivery_update_order_review' );
|
||||
|
||||
/**
|
||||
* Add deposit fee if there is no bottle exchange.
|
||||
*
|
||||
* @param WC_Cart $cart Cart object.
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_add_fees( $cart ) {
|
||||
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $cart instanceof WC_Cart ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$bottle_exchange = WC()->session ? WC()->session->get( 'tw_bottle_exchange', 'exchange' ) : 'exchange';
|
||||
|
||||
if ( 'no_exchange' === $bottle_exchange ) {
|
||||
$cart->add_fee( __( 'Залог за тару', 'twentytwentyfour' ), twentytwentyfour_water_delivery_deposit_fee(), false );
|
||||
}
|
||||
}
|
||||
add_action( 'woocommerce_cart_calculate_fees', 'twentytwentyfour_water_delivery_add_fees' );
|
||||
|
||||
/**
|
||||
* Validate custom checkout data.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_validate_checkout() {
|
||||
if ( empty( $_POST['billing_phone'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$phone_digits = preg_replace( '/\D+/', '', wp_unslash( $_POST['billing_phone'] ) );
|
||||
|
||||
if ( strlen( $phone_digits ) < 11 ) {
|
||||
wc_add_notice( __( 'Укажите корректный телефон для подтверждения заказа.', 'twentytwentyfour' ), 'error' );
|
||||
}
|
||||
}
|
||||
add_action( 'woocommerce_checkout_process', 'twentytwentyfour_water_delivery_validate_checkout' );
|
||||
|
||||
/**
|
||||
* Save custom checkout fields to order meta.
|
||||
*
|
||||
* @param int $order_id Order ID.
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_save_checkout_meta( $order_id ) {
|
||||
$fields = array(
|
||||
'billing_house',
|
||||
'billing_flat',
|
||||
'billing_entrance_floor',
|
||||
'tw_delivery_day',
|
||||
'tw_delivery_time',
|
||||
'tw_bottle_exchange',
|
||||
);
|
||||
|
||||
foreach ( $fields as $field ) {
|
||||
if ( isset( $_POST[ $field ] ) ) {
|
||||
update_post_meta( $order_id, '_' . $field, sanitize_text_field( wp_unslash( $_POST[ $field ] ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'woocommerce_checkout_update_order_meta', 'twentytwentyfour_water_delivery_save_checkout_meta' );
|
||||
|
||||
/**
|
||||
* Add cart helper panel before the cart table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_before_cart() {
|
||||
$threshold = twentytwentyfour_water_delivery_free_shipping_threshold();
|
||||
$subtotal = WC()->cart ? (float) WC()->cart->get_subtotal() : 0;
|
||||
$remaining = max( 0, $threshold - $subtotal );
|
||||
$account_url = function_exists( 'wc_get_account_endpoint_url' ) ? wc_get_account_endpoint_url( 'orders' ) : '';
|
||||
?>
|
||||
<div class="water-commerce-panel water-commerce-panel-cart">
|
||||
<div class="water-commerce-panel-head">
|
||||
<h2><?php esc_html_e( 'Проверьте заказ перед оформлением', 'twentytwentyfour' ); ?></h2>
|
||||
<p><?php esc_html_e( 'Измените количество бутылей, удалите лишние позиции и перейдите к оформлению доставки воды по Севастополю.', 'twentytwentyfour' ); ?></p>
|
||||
</div>
|
||||
<div class="water-commerce-benefits">
|
||||
<span><?php esc_html_e( 'Доставка воды по Севастополю за 2-4 часа', 'twentytwentyfour' ); ?></span>
|
||||
<span><?php esc_html_e( 'Работаем ежедневно', 'twentytwentyfour' ); ?></span>
|
||||
<span><?php esc_html_e( 'Чистая сертифицированная вода', 'twentytwentyfour' ); ?></span>
|
||||
</div>
|
||||
<div class="water-commerce-alerts">
|
||||
<?php if ( $remaining > 0 ) : ?>
|
||||
<div class="water-commerce-alert"><?php echo wp_kses_post( sprintf( 'Добавьте товаров еще на %s — доставка может стать бесплатной.', wc_price( $remaining ) ) ); ?></div>
|
||||
<?php else : ?>
|
||||
<div class="water-commerce-alert is-success"><?php esc_html_e( 'Отлично: сумма заказа подходит под бесплатную доставку, если это доступно в вашей зоне.', 'twentytwentyfour' ); ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="water-commerce-alert"><?php esc_html_e( 'Если используете новую бутыль без обмена, залог за тару будет показан отдельной строкой.', 'twentytwentyfour' ); ?></div>
|
||||
</div>
|
||||
<?php if ( is_user_logged_in() && $account_url ) : ?>
|
||||
<div class="water-commerce-repeat-order"><a class="ghost-button" href="<?php echo esc_url( $account_url ); ?>"><?php esc_html_e( 'Повторить прошлый заказ', 'twentytwentyfour' ); ?></a></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
add_action( 'woocommerce_before_cart', 'twentytwentyfour_water_delivery_before_cart', 5 );
|
||||
|
||||
/**
|
||||
* Add SEO content after the cart.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_after_cart() {
|
||||
?>
|
||||
<section class="water-seo-copy-section water-seo-copy-section-cart">
|
||||
<h2><?php esc_html_e( 'Доставка воды в Севастополе: оформить заказ онлайн', 'twentytwentyfour' ); ?></h2>
|
||||
<p><?php echo esc_html( twentytwentyfour_water_delivery_seo_copy( 'cart' ) ); ?></p>
|
||||
</section>
|
||||
<?php
|
||||
}
|
||||
add_action( 'woocommerce_after_cart', 'twentytwentyfour_water_delivery_after_cart', 15 );
|
||||
|
||||
/**
|
||||
* Add order CTA hints before submit button.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_before_submit() {
|
||||
?>
|
||||
<div class="water-checkout-submit-box">
|
||||
<div class="water-checkout-submit-note"><?php esc_html_e( 'Доставим сегодня при заказе до 18:00 в доступных районах Севастополя.', 'twentytwentyfour' ); ?></div>
|
||||
<ul class="water-checkout-submit-list">
|
||||
<li><?php esc_html_e( 'Телефон нужен для быстрого подтверждения заказа', 'twentytwentyfour' ); ?></li>
|
||||
<li><?php esc_html_e( 'Стоимость доставки рассчитывается по зоне WooCommerce', 'twentytwentyfour' ); ?></li>
|
||||
<li><?php esc_html_e( 'Залог за тару показывается отдельной строкой, если нет обмена', 'twentytwentyfour' ); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
add_action( 'woocommerce_review_order_before_submit', 'twentytwentyfour_water_delivery_before_submit', 5 );
|
||||
|
||||
/**
|
||||
* Customize the empty cart message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_empty_cart_message() {
|
||||
return __( 'Корзина пока пуста. Перейдите в каталог и выберите воду 19 литров, питьевую воду или дополнительные товары для доставки по Севастополю.', 'twentytwentyfour' );
|
||||
}
|
||||
add_filter( 'wc_empty_cart_message', 'twentytwentyfour_water_delivery_empty_cart_message' );
|
||||
|
||||
/**
|
||||
* Add custom CTA below empty cart message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_empty_cart_cta() {
|
||||
if ( ! function_exists( 'is_cart' ) || ! is_cart() || ! WC()->cart || ! WC()->cart->is_empty() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="water-empty-cart-cta"><a class="button" href="<?php echo esc_url( home_url( '/test1/#catalog' ) ); ?>"><?php esc_html_e( 'Перейти в каталог', 'twentytwentyfour' ); ?></a></div>
|
||||
<?php
|
||||
}
|
||||
add_action( 'woocommerce_cart_is_empty', 'twentytwentyfour_water_delivery_empty_cart_cta', 20 );
|
||||
|
||||
/**
|
||||
* Customize page title for cart and checkout if no SEO plugin is active.
|
||||
*
|
||||
* @param string $title Document title.
|
||||
* @return string
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_document_title( $title ) {
|
||||
if ( twentytwentyfour_has_seo_plugin() ) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
if ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) {
|
||||
return 'Оформить заказ воды в Севастополе - доставка 19л на дом';
|
||||
}
|
||||
|
||||
if ( function_exists( 'is_cart' ) && is_cart() ) {
|
||||
return 'Корзина - заказать воду 19 литров с доставкой по Севастополю';
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
add_filter( 'pre_get_document_title', 'twentytwentyfour_water_delivery_document_title' );
|
||||
|
||||
/**
|
||||
* Add fallback meta description and schema for cart/checkout.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_water_delivery_meta_and_schema() {
|
||||
if ( twentytwentyfour_has_seo_plugin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! ( ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) || ( function_exists( 'is_cart' ) && is_cart() ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$description = 'Быстрая доставка питьевой воды по Севастополю. Закажите воду 19 литров с доставкой на дом или в офис. Удобная оплата.';
|
||||
|
||||
if ( function_exists( 'is_cart' ) && is_cart() ) {
|
||||
$description = 'Проверьте корзину и оформите заказ воды в Севастополе. Вода 19 литров, питьевая и минеральная вода с доставкой на дом или в офис.';
|
||||
}
|
||||
|
||||
$schema = array(
|
||||
'@context' => 'https://schema.org',
|
||||
'@graph' => array(
|
||||
array(
|
||||
'@type' => 'LocalBusiness',
|
||||
'name' => get_bloginfo( 'name' ),
|
||||
'telephone' => '+7 (978) 123-45-67',
|
||||
'address' => array(
|
||||
'@type' => 'PostalAddress',
|
||||
'addressLocality' => 'Севастополь',
|
||||
'addressCountry' => 'RU',
|
||||
),
|
||||
'areaServed' => array( 'Гагаринский район', 'Ленинский район', 'Нахимовский район', 'Балаклава' ),
|
||||
),
|
||||
array(
|
||||
'@type' => 'Product',
|
||||
'name' => 'Вода 19 литров с доставкой',
|
||||
'description' => 'Питьевая вода с доставкой на дом и в офис по Севастополю.',
|
||||
'offers' => array(
|
||||
'@type' => 'Offer',
|
||||
'priceCurrency' => 'RUB',
|
||||
'availability' => 'https://schema.org/InStock',
|
||||
),
|
||||
'aggregateRating' => array(
|
||||
'@type' => 'AggregateRating',
|
||||
'ratingValue' => '4.9',
|
||||
'reviewCount' => '87',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
<meta name="description" content="<?php echo esc_attr( $description ); ?>">
|
||||
<script type="application/ld+json"><?php echo wp_json_encode( $schema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); ?></script>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_head', 'twentytwentyfour_water_delivery_meta_and_schema', 5 );
|
||||
|
||||
Reference in New Issue
Block a user