hesabixWpTheme/inc/woocommerce-shop.php

633 lines
21 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* بهبود صفحهٔ فروشگاه — Hero، دسته‌ها، toolbar، سایدبار پیش‌فرض و بلوک‌های اعتماد.
*
* @package Hesabix2
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* آیا صفحهٔ اصلی فروشگاه است (نه دسته/برچسب)؟
*/
function hesabix2_wc_is_main_shop_page() {
return hesabix2_is_woocommerce_active()
&& function_exists( 'is_shop' )
&& is_shop()
&& ! is_search();
}
/**
* آیا صفحهٔ لیست محصولات است؟
*/
function hesabix2_wc_is_product_listing_page() {
if ( ! hesabix2_is_woocommerce_active() ) {
return false;
}
if ( function_exists( 'hesabix2_wc_is_product_search' ) && hesabix2_wc_is_product_search() ) {
return false;
}
if ( function_exists( 'is_product' ) && is_product() ) {
return false;
}
if ( function_exists( 'is_shop' ) && is_shop() ) {
return true;
}
if ( function_exists( 'is_product_taxonomy' ) && is_product_taxonomy() ) {
return true;
}
return function_exists( 'is_post_type_archive' ) && is_post_type_archive( 'product' );
}
/**
* تعداد محصولات منتشرشدهٔ قابل‌نمایش در فروشگاه.
*/
function hesabix2_wc_count_published_products() {
if ( ! hesabix2_is_woocommerce_active() ) {
return 0;
}
$args = array(
'status' => 'publish',
'limit' => -1,
'return' => 'ids',
);
if ( function_exists( 'is_product_taxonomy' ) && is_product_taxonomy() ) {
$term = get_queried_object();
if ( $term instanceof WP_Term ) {
$args[ $term->taxonomy ] = array( $term->slug );
}
}
return count( wc_get_products( $args ) );
}
/**
* آیا کاتالوگ کم‌محصول است؟
*/
function hesabix2_wc_is_sparse_catalog() {
$count = hesabix2_wc_count_published_products();
return $count > 0 && $count < 4;
}
/**
* عنوان صفحهٔ فروشگاه.
*
* @param string $title .
* @return string
*/
function hesabix2_wc_shop_page_title( $title ) {
if ( hesabix2_wc_is_main_shop_page() ) {
return __( 'فروشگاه حسابیکس — افزونه، لایسنس و تجهیزات', 'hesabix2' );
}
return $title;
}
add_filter( 'woocommerce_page_title', 'hesabix2_wc_shop_page_title', 20 );
/**
* در صفحهٔ اصلی فروشگاه عنوان تکراری آرشیو را مخفی کن (Hero همان H1 را دارد).
*
* @param bool $show .
* @return bool
*/
function hesabix2_wc_hide_archive_title_on_main_shop( $show ) {
if ( hesabix2_wc_is_main_shop_page() ) {
return false;
}
return $show;
}
add_filter( 'woocommerce_show_page_title', 'hesabix2_wc_hide_archive_title_on_main_shop', 20 );
/**
* کلاس بدنه برای کاتالوگ کم‌محصول.
*
* @param string[] $classes .
* @return string[]
*/
function hesabix2_wc_sparse_catalog_body_class( $classes ) {
if ( hesabix2_wc_is_main_shop_page() && hesabix2_wc_is_sparse_catalog() ) {
$classes[] = 'hesabix-wc-sparse-catalog';
}
return $classes;
}
add_filter( 'body_class', 'hesabix2_wc_sparse_catalog_body_class', 25 );
/**
* حذف مرتب‌سازی در کاتالوگ کم‌محصول.
*/
function hesabix2_wc_maybe_hide_catalog_ordering() {
if ( hesabix2_wc_is_main_shop_page() && hesabix2_wc_is_sparse_catalog() ) {
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
}
}
add_action( 'wp', 'hesabix2_wc_maybe_hide_catalog_ordering', 25 );
/**
* جایگزینی جستجوی قدیمی با toolbar یکپارچه.
*/
function hesabix2_wc_replace_legacy_shop_search() {
remove_action( 'woocommerce_before_shop_loop', 'hesabix2_wc_render_shop_search_bar', 8 );
remove_action( 'woocommerce_no_products_found', 'hesabix2_wc_render_shop_search_bar', 5 );
}
add_action( 'wp', 'hesabix2_wc_replace_legacy_shop_search', 20 );
/**
* ثبت hookهای toolbar فروشگاه.
*/
function hesabix2_wc_register_shop_toolbar_hooks() {
if ( ! hesabix2_is_woocommerce_active() ) {
return;
}
add_action( 'woocommerce_before_shop_loop', 'hesabix2_wc_shop_toolbar_open', 12 );
add_action( 'woocommerce_before_shop_loop', 'hesabix2_wc_shop_toolbar_search', 14 );
add_action( 'woocommerce_before_shop_loop', 'hesabix2_wc_shop_toolbar_close', 35 );
}
add_action( 'init', 'hesabix2_wc_register_shop_toolbar_hooks' );
/**
* @return bool
*/
function hesabix2_wc_shop_toolbar_should_render() {
return hesabix2_wc_is_product_listing_page();
}
/**
* شروع toolbar فروشگاه.
*/
function hesabix2_wc_shop_toolbar_open() {
if ( ! hesabix2_wc_shop_toolbar_should_render() ) {
return;
}
echo '<div class="woocommerce-before-shop-loop hesabix-wc-shop-toolbar">';
}
/**
* جستجو داخل toolbar.
*/
function hesabix2_wc_shop_toolbar_search() {
if ( ! hesabix2_wc_shop_toolbar_should_render() ) {
return;
}
echo '<div class="hesabix-wc-shop-toolbar__search" role="search">';
get_product_search_form();
echo '</div>';
}
/**
* پایان toolbar فروشگاه.
*/
function hesabix2_wc_shop_toolbar_close() {
if ( ! hesabix2_wc_shop_toolbar_should_render() ) {
return;
}
echo '</div>';
}
/**
* آیا بلوک معرفی آرشیو (توضیح صفحه) باید نمایش داده شود؟
*/
function hesabix2_wc_shop_has_archive_intro() {
if ( ! hesabix2_wc_is_main_shop_page() ) {
return true;
}
$shop_id = wc_get_page_id( 'shop' );
if ( $shop_id <= 0 ) {
return false;
}
$post = get_post( $shop_id );
return $post instanceof WP_Post && '' !== trim( wp_strip_all_tags( $post->post_content ) );
}
/**
* Hero صفحهٔ فروشگاه.
*/
function hesabix2_wc_render_shop_hero() {
$contact_url = function_exists( 'hesabix2_contact_page_url' ) ? hesabix2_contact_page_url() : home_url( '/contact/' );
$arc_url = function_exists( 'hesabix2_fp_arc_url' ) ? hesabix2_fp_arc_url() : 'https://arc.hesabix.ir';
?>
<section class="hesabix-wc-shop-hero" aria-label="<?php esc_attr_e( 'فروشگاه حسابیکس', 'hesabix2' ); ?>">
<div class="hesabix-wc-shop-hero__inner">
<p class="hesabix-wc-shop-hero__badge">
<span class="hesabix-wc-shop-hero__badge-dot" aria-hidden="true"></span>
<?php esc_html_e( 'بازار محصولات حسابیکس', 'hesabix2' ); ?>
</p>
<h1 id="hesabix-wc-shop-hero-title" class="hesabix-wc-shop-hero__title">
<?php echo esc_html( hesabix2_wc_shop_page_title( '' ) ?: __( 'فروشگاه حسابیکس — افزونه، لایسنس و تجهیزات', 'hesabix2' ) ); ?>
</h1>
<p class="hesabix-wc-shop-hero__subtitle">
<?php esc_html_e( 'افزونه، لایسنس و تجهیزات یکپارچه با آرک — محصولات دیجیتال و سخت‌افزار فروشگاهی با پشتیبانی تیم حسابیکس.', 'hesabix2' ); ?>
</p>
<div class="hesabix-wc-shop-hero__actions">
<a href="#hesabix-wc-shop-platform" class="hesabix-wc-shop-hero__cta hesabix-wc-shop-hero__cta--primary">
<?php esc_html_e( 'مشاهده افزونه‌ها', 'hesabix2' ); ?>
</a>
<a href="<?php echo esc_url( $contact_url ); ?>" class="hesabix-wc-shop-hero__cta hesabix-wc-shop-hero__cta--secondary">
<?php esc_html_e( 'راهنمای خرید', 'hesabix2' ); ?>
</a>
<a href="<?php echo esc_url( $arc_url ); ?>" class="hesabix-wc-shop-hero__cta hesabix-wc-shop-hero__cta--ghost" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'شروع رایگان — آرک', 'hesabix2' ); ?>
</a>
</div>
</div>
</section>
<?php
}
/**
* دسته‌های ریشه برای نمایش در صفحهٔ فروشگاه.
*
* @return WP_Term[]
*/
function hesabix2_wc_get_shop_root_categories() {
$default_cat = (int) get_option( 'default_product_cat', 0 );
$terms = get_terms(
array(
'taxonomy' => 'product_cat',
'hide_empty' => false,
'parent' => 0,
'orderby' => 'count',
'order' => 'DESC',
)
);
if ( empty( $terms ) || is_wp_error( $terms ) ) {
return array();
}
return array_values(
array_filter(
$terms,
static function ( $term ) use ( $default_cat ) {
if ( (int) $term->count < 1 ) {
return false;
}
if ( (int) $term->term_id === $default_cat && 'uncategorized' === $term->slug ) {
return false;
}
return true;
}
)
);
}
/**
* کارت‌های دستهٔ محصول.
*/
function hesabix2_wc_render_shop_category_cards() {
$terms = hesabix2_wc_get_shop_root_categories();
if ( empty( $terms ) ) {
return;
}
?>
<section class="hesabix-wc-shop-categories" aria-labelledby="hesabix-wc-shop-categories-title">
<div class="hesabix-wc-shop-categories__head">
<h2 id="hesabix-wc-shop-categories-title" class="hesabix-wc-shop-categories__title">
<?php esc_html_e( 'دسته‌بندی محصولات', 'hesabix2' ); ?>
</h2>
<p class="hesabix-wc-shop-categories__desc">
<?php esc_html_e( 'بر اساس نیاز کسب‌وکار خود دستهٔ مناسب را انتخاب کنید.', 'hesabix2' ); ?>
</p>
</div>
<div class="hesabix-wc-shop-categories__grid">
<?php foreach ( $terms as $term ) : ?>
<?php
$thumb_id = (int) get_term_meta( $term->term_id, 'thumbnail_id', true );
$thumb = $thumb_id ? wp_get_attachment_image_url( $thumb_id, 'woocommerce_thumbnail' ) : '';
$count = (int) $term->count;
?>
<a href="<?php echo esc_url( get_term_link( $term ) ); ?>" class="hesabix-wc-shop-category-card">
<span class="hesabix-wc-shop-category-card__media" aria-hidden="true">
<?php if ( $thumb ) : ?>
<img src="<?php echo esc_url( $thumb ); ?>" alt="" width="80" height="80" loading="lazy" decoding="async">
<?php else : ?>
<span class="hesabix-wc-shop-category-card__placeholder"></span>
<?php endif; ?>
</span>
<span class="hesabix-wc-shop-category-card__body">
<span class="hesabix-wc-shop-category-card__name"><?php echo esc_html( $term->name ); ?></span>
<?php if ( $term->description ) : ?>
<span class="hesabix-wc-shop-category-card__text"><?php echo esc_html( wp_trim_words( $term->description, 12, '…' ) ); ?></span>
<?php endif; ?>
<span class="hesabix-wc-shop-category-card__count">
<?php
printf(
/* translators: %s: product count */
esc_html( _n( '%s محصول', '%s محصول', $count, 'hesabix2' ) ),
esc_html( number_format_i18n( $count ) )
);
?>
</span>
</span>
</a>
<?php endforeach; ?>
</div>
</section>
<?php
}
/**
* کارت‌های محصولات پلتفرم (افزونه‌ها و منابع).
*/
function hesabix2_wc_get_platform_product_cards() {
return array(
array(
'title' => __( 'افزونه ووکامرس آرک', 'hesabix2' ),
'desc' => __( 'اتصال فروشگاه وردپرس به پلتفرم آرک — همگام‌سازی سفارش و موجودی.', 'hesabix2' ),
'url' => 'https://source.hesabix.ir/hesabix/ArcWOC/releases',
'tag' => __( 'افزونه', 'hesabix2' ),
),
array(
'title' => __( 'افزونه چت آنلاین', 'hesabix2' ),
'desc' => __( 'گفت‌وگوی زنده با بازدیدکنندگان سایت و یکپارچگی با CRM.', 'hesabix2' ),
'url' => 'https://source.hesabix.ir/hesabix/HesabixChatPlugin/releases',
'tag' => __( 'افزونه', 'hesabix2' ),
),
array(
'title' => __( 'افزونه ووکامرس شادمان', 'hesabix2' ),
'desc' => __( 'نسخهٔ legacy برای کاربران شادمان — انتشار در مخزن سورس.', 'hesabix2' ),
'url' => 'https://source.hesabix.ir/morrning/hesabixWCPlugin/releases',
'tag' => __( 'افزونه', 'hesabix2' ),
),
array(
'title' => __( 'پشتیبانی و مشاوره فروش', 'hesabix2' ),
'desc' => __( 'برای انتخاب محصول مناسب یا سفارش سازمانی با تیم ما در تماس باشید.', 'hesabix2' ),
'url' => function_exists( 'hesabix2_contact_page_url' ) ? hesabix2_contact_page_url() : home_url( '/contact/' ),
'tag' => __( 'خدمات', 'hesabix2' ),
),
);
}
/**
* بخش محصولات مرتبط با پلتفرم.
*/
function hesabix2_wc_render_shop_platform_products() {
$cards = hesabix2_wc_get_platform_product_cards();
if ( empty( $cards ) ) {
return;
}
?>
<section id="hesabix-wc-shop-platform" class="hesabix-wc-shop-platform" aria-labelledby="hesabix-wc-shop-platform-title">
<div class="hesabix-wc-shop-platform__head">
<h2 id="hesabix-wc-shop-platform-title" class="hesabix-wc-shop-platform__title">
<?php esc_html_e( 'افزونه‌ها و منابع پلتفرم', 'hesabix2' ); ?>
</h2>
<p class="hesabix-wc-shop-platform__desc">
<?php esc_html_e( 'دانلود مستقیم از مخازن کد باز حسابیکس — رایگان و متن‌باز.', 'hesabix2' ); ?>
</p>
</div>
<div class="hesabix-wc-shop-platform__grid">
<?php foreach ( $cards as $card ) : ?>
<a href="<?php echo esc_url( $card['url'] ); ?>" class="hesabix-wc-shop-platform-card"<?php echo ( 0 === strpos( $card['url'], 'http' ) && false === strpos( $card['url'], home_url() ) ) ? ' target="_blank" rel="noopener noreferrer"' : ''; ?>>
<span class="hesabix-wc-shop-platform-card__tag"><?php echo esc_html( $card['tag'] ); ?></span>
<span class="hesabix-wc-shop-platform-card__title"><?php echo esc_html( $card['title'] ); ?></span>
<span class="hesabix-wc-shop-platform-card__desc"><?php echo esc_html( $card['desc'] ); ?></span>
<span class="hesabix-wc-shop-platform-card__link"><?php esc_html_e( 'مشاهده', 'hesabix2' ); ?> <span aria-hidden="true">←</span></span>
</a>
<?php endforeach; ?>
</div>
</section>
<?php
}
/**
* پیام کاتالوگ در حال گسترش.
*/
function hesabix2_wc_render_sparse_catalog_notice() {
$contact_url = function_exists( 'hesabix2_contact_page_url' ) ? hesabix2_contact_page_url() : home_url( '/contact/' );
?>
<div class="hesabix-wc-shop-growing" role="note">
<p class="hesabix-wc-shop-growing__text">
<?php esc_html_e( 'فروشگاه در حال گسترش است — محصولات بیشتر به‌زودی اضافه می‌شوند.', 'hesabix2' ); ?>
</p>
<a href="<?php echo esc_url( $contact_url ); ?>" class="hesabix-wc-shop-growing__link">
<?php esc_html_e( 'پیشنهاد محصول یا درخواست سفارشی', 'hesabix2' ); ?>
</a>
</div>
<?php
}
/**
* بلوک‌های اعتماد زیر محصولات.
*/
function hesabix2_wc_render_shop_trust_blocks() {
$contact_url = function_exists( 'hesabix2_contact_page_url' ) ? hesabix2_contact_page_url() : home_url( '/contact/' );
$items = array(
array(
'title' => __( 'پرداخت امن', 'hesabix2' ),
'desc' => __( 'فرایند خرید استاندارد ووکامرس با حفاظت اطلاعات.', 'hesabix2' ),
),
array(
'title' => __( 'پشتیبانی تلفنی', 'hesabix2' ),
'desc' => '۰۲۱-۹۱۵۵۰۲۹۰',
),
array(
'title' => __( 'یکپارچگی با آرک', 'hesabix2' ),
'desc' => __( 'محصولات سازگار با پلتفرم جامع حسابیکس.', 'hesabix2' ),
),
array(
'title' => __( 'پاسخ‌گویی سریع', 'hesabix2' ),
'desc' => __( 'تیم پشتیبانی در کنار شما قبل و بعد از خرید.', 'hesabix2' ),
),
);
?>
<section class="hesabix-wc-shop-trust" aria-labelledby="hesabix-wc-shop-trust-title">
<h2 id="hesabix-wc-shop-trust-title" class="screen-reader-text"><?php esc_html_e( 'چرا از فروشگاه حسابیکس خرید کنم؟', 'hesabix2' ); ?></h2>
<div class="hesabix-wc-shop-trust__grid">
<?php foreach ( $items as $item ) : ?>
<div class="hesabix-wc-shop-trust-card">
<h3 class="hesabix-wc-shop-trust-card__title"><?php echo esc_html( $item['title'] ); ?></h3>
<p class="hesabix-wc-shop-trust-card__desc"><?php echo esc_html( $item['desc'] ); ?></p>
</div>
<?php endforeach; ?>
</div>
<p class="hesabix-wc-shop-trust__footer">
<?php esc_html_e( 'سوال دارید؟', 'hesabix2' ); ?>
<a href="<?php echo esc_url( $contact_url ); ?>"><?php esc_html_e( 'تماس با پشتیبانی فروش', 'hesabix2' ); ?></a>
</p>
</section>
<?php
}
/**
* سایدبار پیش‌فرض فروشگاه وقتی ویجتی ثبت نشده.
*/
function hesabix2_wc_render_default_shop_sidebar() {
$shop_url = hesabix2_wc_shop_url();
$contact_url = function_exists( 'hesabix2_contact_page_url' ) ? hesabix2_contact_page_url() : home_url( '/contact/' );
$terms = get_terms(
array(
'taxonomy' => 'product_cat',
'hide_empty' => true,
'parent' => 0,
'number' => 8,
)
);
?>
<div class="hesabix-wc-widget hesabix-wc-widget--search">
<p class="hesabix-wc-widget__title"><?php esc_html_e( 'جستجوی محصول', 'hesabix2' ); ?></p>
<?php get_product_search_form(); ?>
</div>
<?php if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) : ?>
<div class="hesabix-wc-widget hesabix-wc-widget--categories">
<p class="hesabix-wc-widget__title"><?php esc_html_e( 'دسته‌های محصول', 'hesabix2' ); ?></p>
<ul class="hesabix-wc-sidebar-cats">
<?php foreach ( $terms as $term ) : ?>
<li>
<a href="<?php echo esc_url( get_term_link( $term ) ); ?>">
<?php echo esc_html( $term->name ); ?>
<span class="hesabix-wc-sidebar-cats__count"><?php echo esc_html( number_format_i18n( (int) $term->count ) ); ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<div class="hesabix-wc-widget hesabix-wc-widget--help">
<p class="hesabix-wc-widget__title"><?php esc_html_e( 'راهنمای خرید', 'hesabix2' ); ?></p>
<ul class="hesabix-wc-sidebar-links">
<li><a href="<?php echo esc_url( $shop_url ); ?>"><?php esc_html_e( 'همهٔ محصولات', 'hesabix2' ); ?></a></li>
<li><a href="#hesabix-wc-shop-platform"><?php esc_html_e( 'افزونه‌های پلتفرم', 'hesabix2' ); ?></a></li>
<li><a href="<?php echo esc_url( $contact_url ); ?>"><?php esc_html_e( 'تماس با پشتیبانی', 'hesabix2' ); ?></a></li>
</ul>
</div>
<?php
}
/**
* برچسب دسته روی کارت محصول.
*/
function hesabix2_wc_loop_product_category_badge() {
global $product;
if ( ! is_a( $product, WC_Product::class ) ) {
return;
}
$cats = wc_get_product_terms( $product->get_id(), 'product_cat', array( 'number' => 1 ) );
if ( empty( $cats ) || is_wp_error( $cats ) ) {
return;
}
$cat = $cats[0];
echo '<a href="' . esc_url( get_term_link( $cat ) ) . '" class="hesabix-wc-product-card__badge">' . esc_html( $cat->name ) . '</a>';
}
add_action( 'woocommerce_before_shop_loop_item', 'hesabix2_wc_loop_product_category_badge', 9 );
/**
* دکمهٔ مشاهده جزئیات در کارت محصول.
*/
function hesabix2_wc_loop_view_details_button() {
global $product;
if ( ! is_a( $product, WC_Product::class ) ) {
return;
}
echo '<a href="' . esc_url( $product->get_permalink() ) . '" class="button hesabix-wc-product-card__details">' . esc_html__( 'مشاهده جزئیات', 'hesabix2' ) . '</a>';
}
add_action( 'woocommerce_after_shop_loop_item', 'hesabix2_wc_loop_view_details_button', 15 );
/**
* فاصله قبل از نماد ارز در قیمت.
*
* @param string $formatted .
* @return string
*/
function hesabix2_wc_price_currency_spacing( $formatted ) {
if ( false === strpos( $formatted, 'woocommerce-Price-currencySymbol' ) ) {
return $formatted;
}
return str_replace(
'<span class="woocommerce-Price-currencySymbol"',
' <span class="woocommerce-Price-currencySymbol"',
$formatted
);
}
add_filter( 'wc_price', 'hesabix2_wc_price_currency_spacing' );
/**
* سئو: عنوان و توضیح صفحهٔ فروشگاه برای Yoast.
*
* @param string $title .
* @return string
*/
function hesabix2_wc_seo_shop_title( $title ) {
if ( ! hesabix2_wc_is_main_shop_page() ) {
return $title;
}
return __( 'فروشگاه حسابیکس | افزونه، لایسنس و تجهیزات', 'hesabix2' );
}
add_filter( 'wpseo_title', 'hesabix2_wc_seo_shop_title', 15 );
add_filter( 'wpseo_opengraph_title', 'hesabix2_wc_seo_shop_title', 15 );
/**
* @param string $desc .
* @return string
*/
function hesabix2_wc_seo_shop_description( $desc ) {
if ( ! hesabix2_wc_is_main_shop_page() ) {
return $desc;
}
return __( 'فروشگاه رسمی حسابیکس — افزونه‌های ووکامرس، لایسنس، تجهیزات فروشگاهی و محصولات دیجیتال یکپارچه با پلتفرم آرک.', 'hesabix2' );
}
add_filter( 'wpseo_metadesc', 'hesabix2_wc_seo_shop_description', 15 );
add_filter( 'wpseo_opengraph_desc', 'hesabix2_wc_seo_shop_description', 15 );
/**
* Schema ItemList برای صفحهٔ فروشگاه.
*/
function hesabix2_wc_shop_itemlist_schema() {
if ( ! hesabix2_wc_is_main_shop_page() || ! function_exists( 'hesabix2_seo_print_json_ld' ) ) {
return;
}
$products = wc_get_products(
array(
'status' => 'publish',
'limit' => 12,
'return' => 'objects',
)
);
if ( empty( $products ) ) {
return;
}
$items = array();
$pos = 1;
foreach ( $products as $product ) {
if ( ! $product instanceof WC_Product ) {
continue;
}
$items[] = array(
'@type' => 'ListItem',
'position' => $pos++,
'url' => $product->get_permalink(),
'name' => $product->get_name(),
);
}
if ( empty( $items ) ) {
return;
}
hesabix2_seo_print_json_ld(
array(
'@context' => 'https://schema.org',
'@type' => 'ItemList',
'name' => __( 'فروشگاه حسابیکس', 'hesabix2' ),
'itemListElement' => $items,
)
);
}
add_action( 'wp_head', 'hesabix2_wc_shop_itemlist_schema', 25 );