product 相关问题

产品是一种可以买卖的产品。使用此标签仅指经济或商业意义上的产品。对于产品的数学概念,请改用标签[乘法]。

更改 php 中特定 woocommerce 产品类别的每行列/产品数

我正在使用 Woocommerce 3.3.3 并尝试更改特定产品类别而不是其他产品类别的列数。 我尝试了几种代码选项,但它们都适用......

回答 3 投票 0

从产品自定义字段更改 woocommerce 产品名称/标题

我想用现有的“customname1”自定义字段覆盖类别和产品页面上单个产品的名称/标题。 每当“自定义...

回答 2 投票 0

Mixpanel 达到极限

关于 Mixpanel 免费套餐的直接问题! 如果在免费套餐中并且达到跟踪事件的限制会发生什么 它会默默地失败吗? 或者用户会看到任何错误消息吗?

回答 1 投票 0

如何从 WooCommerce 管理产品快速编辑中隐藏特定字段

我试图从“快速编辑”窗口隐藏一些 WooCoomerce 字段:“日期”、“税务状态”、“税务类别”、“重量”、“长/宽/高”、“发货.. .

回答 1 投票 0

如何从“快速编辑”窗口隐藏 WooCommerce 字段?

我试图从“快速编辑”窗口隐藏一些 WooCoomerce 字段:“日期”、“税务状态”、“税务类别”、“重量”、“长/宽/高”、“发货.. .

回答 1 投票 0

强制特定产品的最低订购量,包括 WooCommerce 购物车页面上的变化

我正在尝试在 WooCommerce 中实现以下目标。我想为特定产品设置最小订购量。 问题是,这个产品是一个可变产品,我想设置一个

回答 2 投票 0

Woocommerce - 仅在循环中显示分组产品父级

我正在建一家书店。我有一堆分组产品。我的痛苦是,woocommerce 默认列出这两种类型。我只需要列出该组的父级,没有子级。 是...

回答 6 投票 0

Woocommerce 按类别更改库存文本

所以标题怎么说,我有一个多产品“测试”网站。并且每个产品在商店页面都有“X 库存”。 我的网站按“楼层”和&...等类别进行过滤

回答 3 投票 0

速卖通(淘宝)附属API - 获取商品信息

也许你可以帮助我。 我正在使用 AliExpress(淘宝)的 Affiliate API 通过搜索键获取产品列表。它看起来像这样: https://developers.aliexpress.com/en/doc.htm?docId=45803&do...

回答 1 投票 0

购物车中某些商品未使用优惠券时阻止结账

我正在 WooCommerce 网站上工作,我试图限制仅在申请优惠券时才购买产品,因此在不添加优惠券代码的情况下不应对其进行处理。 用户必须...

回答 2 投票 0

Magento Rest api 仅提供 10 个产品

我正在使用 REST 调用 Magento 产品列表,但它只显示 10 个产品,而不是全部。 任何人都可以指导,因为这个问题可能会发生吗? 这是我正在使用的代码...

回答 3 投票 0

WooCommerce 产品属性、品牌和价格的自定义动态过滤器问题

我正在尝试创建 Woocommerce 过滤器。基本上一切正常,但存在一些动态问题。 我正在尝试创建一个 Woocommerce 过滤器。基本上一切正常,但存在一些动态问题。 <?php // Functie om gefilterde termen binnen de context van de huidige categorie op te halen function get_filtered_terms($taxonomy, $product_ids, $tax_query) { if (empty($product_ids)) { return array(); // Geen producten, geen termen } // Termen ophalen die zijn gekoppeld aan de huidige product-ID's $terms = get_terms(array( 'taxonomy' => $taxonomy, 'object_ids' => $product_ids, 'hide_empty' => true, )); // Termen specifiek binnen de huidige categorie context tellen $filtered_terms = array(); foreach ($terms as $term) { $term_count_query = new WP_Query(array( 'post_type' => 'product', 'posts_per_page' => -1, 'tax_query' => array_merge($tax_query, array( array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $term->slug, ), )), 'fields' => 'ids', )); $term->count = $term_count_query->found_posts; $filtered_terms[] = $term; } return $filtered_terms; } function custom_filter_form_shortcode() { if (!is_product_category() && !is_tax('brand')) { return ''; // Alleen de filter tonen op categorie- en merkspecifieke pagina's } ob_start(); // Huidige categorie of merk ophalen $queried_object = get_queried_object(); // Filtervolgorde en zichtbaarheid van de instellingenpagina ophalen $filter_order = get_option('filter_order_' . $queried_object->term_id, 'price,brand,size'); $filters_visibility = get_option('filters_visibility_' . $queried_object->term_id, array( 'price' => 1, 'brand' => 1, 'size' => 1 )); // Filtervolgorde verwerken $filter_order = explode(',', $filter_order); // Huidige product-ID's van de query ophalen (alle pagina's) $tax_query = array( 'relation' => 'AND', array( 'taxonomy' => $queried_object->taxonomy, 'field' => 'slug', 'terms' => $queried_object->slug, ), ); // Merkenfilter toevoegen indien ingesteld if (isset($_GET['brand'])) { $tax_query[] = array( 'taxonomy' => 'brand', 'field' => 'slug', 'terms' => $_GET['brand'], 'operator' => 'IN' ); } // Maatfilter toevoegen indien ingesteld if (isset($_GET['size'])) { $tax_query[] = array( 'taxonomy' => 'pa_size', 'field' => 'slug', 'terms' => $_GET['size'], 'operator' => 'IN' ); } $total_product_ids = new WP_Query(array( 'post_type' => 'product', 'posts_per_page' => -1, 'tax_query' => $tax_query, )); $product_ids = wp_list_pluck($total_product_ids->posts, 'ID'); // Filteren van de termen met de huidige filters $brands = get_filtered_terms('brand', $product_ids, $tax_query); // Render de filtervorm ?> <div class="desktop-filter-container"> <form method="get" action="" class="custom-filter-form"> <div class="sort-dropdown"> <label for="orderby">Sorteren op:</label> <select name="orderby" id="orderby" onchange="this.form.submit()"> <?php foreach ($orderby_options as $value => $label) : ?> <option value="<?php echo esc_attr($value); ?>" <?php selected($selected_orderby, $value); ?>><?php echo esc_html($label); ?></option> <?php endforeach; ?> </select> </div> <div class="filter-section"> <h5>Prijs</h5> <div class="price-slider-container"> </div> <div id="price-range"></div> </div> <!-- Merk filter toevoegen --> <?php if (!empty($brands) && !is_wp_error($brands)) { echo '<div class="attribute-section">'; echo '<h4 class="toggle-section" data-index="brand">Merk</h4>'; echo '<div class="attribute-terms">'; $term_count = 0; foreach ($brands as $brand) { $checked = isset($_GET['brand']) && is_array($_GET['brand']) && in_array($brand->slug, $_GET['brand']) ? 'checked' : ''; if ($term_count < 5) { echo '<label class="checkbox-label">'; echo '<input type="checkbox" name="brand[]" value="' . esc_attr($brand->slug) . '" ' . $checked . '>'; echo esc_html($brand->name) . ' <span class="attribute-count">(' . $brand->count . ')</span>'; // Termnaam en aantal tonen echo '</label>'; } else { echo '<label class="checkbox-label more-terms" style="display:none;">'; echo '<input type="checkbox" name="brand[]" value="' . esc_attr($brand->slug) . '" ' . $checked . '>'; echo esc_html($brand->name) . ' <span class="attribute-count">(' . $brand->count . ')</span>'; // Termnaam en aantal tonen echo '</label>'; } $term_count++; } if ($term_count > 5) { echo '<span class="show-more">Toon meer</span>'; } echo '</div>'; echo '</div>'; } ?> <?php // Bestaande attributenfilters $attributes = wc_get_attribute_taxonomies(); $count = 0; foreach ($attributes as $attribute) { $taxonomy = wc_attribute_taxonomy_name($attribute->attribute_name); // Zichtbaarheid controleren voordat je weergeeft if (isset($filters_visibility[$taxonomy]) && $filters_visibility[$taxonomy]) { // Gefilterde termen ophalen met product_ids en huidige tax_query $terms = get_filtered_terms($taxonomy, $product_ids, $tax_query); if (!empty($terms) && !is_wp_error($terms)) { echo '<div class="attribute-section">'; echo '<h4 class="toggle-section" data-index="' . $count . '">' . esc_html($attribute->attribute_label) . '</h4>'; echo '<div class="attribute-terms">'; $term_count = 0; foreach ($terms as $term) { $checked = isset($_GET[$taxonomy]) && is_array($_GET[$taxonomy]) && in_array($term->slug, $_GET[$taxonomy]) ? 'checked' : ''; if ($term_count < 5) { echo '<label class="checkbox-label">'; echo '<input type="checkbox" name="' . esc_attr($taxonomy) . '[]" value="' . esc_attr($term->slug) . '" ' . $checked . '>'; echo esc_html($term->name) . ' <span class="attribute-count">(' . $term->count . ')</span>'; // Termnaam en aantal tonen echo '</label>'; } else { echo '<label class="checkbox-label more-terms" style="display:none;">'; echo '<input type="checkbox" name="' . esc_attr($taxonomy) . '[]" value="' . esc_attr($term->slug) . '" ' . $checked . '>'; echo esc_html($term->name) . ' <span class="attribute-count">(' . $term->count . ')</span>'; // Termnaam en aantal tonen echo '</label>'; } $term_count++; } if ($term_count > 5) { echo '<span class="show-more">Toon meer</span>'; } echo '</div>'; echo '</div>'; $count++; } } } ?> </form> </div> <div class="mobile-filter-container"> <button class="open-filters-btn">Filters</button> <div class="mobile-filters"> <button class="close-filters-btn">&times;</button> <form method="get" action="" class="custom-filter-form"> <div class="sort-dropdown"> <label for="orderby">Sorteren op:</label> <select name="orderby" id="orderby" onchange="this.form.submit()"> <?php foreach ($orderby_options as $value => $label) : ?> <option value="<?php echo esc_attr($value); ?>" <?php selected($selected_orderby, $value); ?>><?php echo esc_html($label); ?></option> <?php endforeach; ?> </select> </div> <div class="filter-section"> <h5>Prijs</h5> <div class="price-slider-container"> </div> <div id="price-range"></div> </div> <!-- Merk filter toevoegen --> <?php $brands = get_filtered_terms('brand', $product_ids, $tax_query); if (!empty($brands) && !is_wp_error($brands)) { echo '<div class="attribute-section">'; echo '<h4 class="toggle-section" data-index="brand">Merk</h4>'; echo '<div class="attribute-terms">'; $term_count = 0; foreach ($brands as $brand) { $checked = isset($_GET['brand']) && is_array($_GET['brand']) && in_array($brand->slug, $_GET['brand']) ? 'checked' : ''; if ($term_count < 5) { echo '<label class="checkbox-label">'; echo '<input type="checkbox" name="brand[]" value="' . esc_attr($brand->slug) . '" ' . $checked . '>'; echo esc_html($brand->name) . ' <span class="attribute-count">(' . $brand->count . ')</span>'; // Termnaam en aantal tonen echo '</label>'; } else { echo '<label class="checkbox-label more-terms" style="display:none;">'; echo '<input type="checkbox" name="brand[]" value="' . esc_attr($brand->slug) . '" ' . $checked . '>'; echo esc_html($brand->name) . ' <span class="attribute-count">(' . $brand->count . ')</span>'; // Termnaam en aantal tonen echo '</label>'; } $term_count++; } if ($term_count > 5) { echo '<span class="show-more">Toon meer</span>'; } echo '</div>'; echo '</div>'; } ?> <?php // Bestaande attributenfilters $attributes = wc_get_attribute_taxonomies(); $count = 0; foreach ($attributes as $attribute) { $taxonomy = wc_attribute_taxonomy_name($attribute->attribute_name); // Zichtbaarheid controleren voordat je weergeeft if (isset($filters_visibility[$taxonomy]) && $filters_visibility[$taxonomy]) { // Gefilterde termen ophalen met product_ids en huidige tax_query $terms = get_filtered_terms($taxonomy, $product_ids, $tax_query); if (!empty($terms) && !is_wp_error($terms)) { echo '<div class="attribute-section">'; echo '<h4 class="toggle-section" data-index="' . $count . '">' . esc_html($attribute->attribute_label) . '</h4>'; echo '<div class="attribute-terms">'; $term_count = 0; foreach ($terms as $term) { $checked = isset($_GET[$taxonomy]) && is_array($_GET[$taxonomy]) && in_array($term->slug, $_GET[$taxonomy]) ? 'checked' : ''; if ($term_count < 5) { echo '<label class="checkbox-label">'; echo '<input type="checkbox" name="' . esc_attr($taxonomy) . '[]" value="' . esc_attr($term->slug) . '" ' . $checked . '>'; echo esc_html($term->name) . ' <span class="attribute-count">(' . $term->count . ')</span>'; // Termnaam en aantal tonen echo '</label>'; } else { echo '<label class="checkbox-label more-terms" style="display:none;">'; echo '<input type="checkbox" name="' . esc_attr($taxonomy) . '[]" value="' . esc_attr($term->slug) . '" ' . $checked . '>'; echo esc_html($term->name) . ' <span class="attribute-count">(' . $term->count . ')</span>'; // Termnaam en aantal tonen echo '</label>'; } $term_count++; } if ($term_count > 5) { echo '<span class="show-more">Toon meer</span>'; } echo '</div>'; echo '</div>'; $count++; } } } ?> <button type="submit" class="apply-filters-btn">Bevestig filters</button> </form> </div> </div> <script> jQuery(document).ready(function($) { function filterProducts() { var selectedBrands = []; var selectedSizes = []; $('.checkbox-label input[name="brand[]"]:checked').each(function() { selectedBrands.push($(this).val()); }); $('.checkbox-label input[name="size[]"]:checked').each(function() { selectedSizes.push($(this).val()); }); $('.products .product').each(function() { var product = $(this); var productPrice = parseFloat(product.data('price')); var productBrands = product.data('brands').split(','); var productSizes = product.data('sizes').split(','); var showProduct = true; if (selectedBrands.length > 0 && !selectedBrands.some(r => productBrands.includes(r))) { showProduct = false; } if (selectedSizes.length > 0 && !selectedSizes.some(r => productSizes.includes(r))) { showProduct = false; } if (productPrice < minPrice || productPrice > maxPrice) { showProduct = false; } if (showProduct) { product.show(); } else { product.hide(); } }); } // Automatically filter the products when a checkbox is clicked $(document).on('change', '.checkbox-label input[type="checkbox"]', function() { $(this).closest('form').submit(); }); // Submit form when user changes the input fields for min and max price $('#min_price, #max_price').on('change keyup', function() { $(this).closest('form').submit(); }); // Mobiele filter toggle $('.open-filters-btn').on('click', function() { $('.mobile-filters').addClass('active'); }); $('.close-filters-btn, .apply-filters-btn').on('click', function() { $('.mobile-filters').removeClass('active'); }); // Initialize filtering filterProducts(); }); </script> <?php return ob_get_clean(); // Zorg ervoor dat deze regel correct is afgesloten } add_shortcode('custom_filter_form', 'custom_filter_form_shortcode'); // Zorg ervoor dat deze regel correct is afgesloten function apply_custom_filters($query) { if (!is_admin() && $query->is_main_query() && (is_product_category() || is_shop() || is_tax('brand'))) { // Huidige categorie of merk ophalen $queried_object = get_queried_object(); $taxonomy = $queried_object->taxonomy; $slug = $queried_object->slug; // Filteren op attributen $tax_query = array( 'relation' => 'AND', array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $slug, ), ); $attributes = wc_get_attribute_taxonomies(); foreach ($attributes as $attribute) { $taxonomy_name = wc_attribute_taxonomy_name($attribute->attribute_name); if (isset($_GET[$taxonomy_name])) { $tax_query[] = array( 'taxonomy' => $taxonomy_name, 'field' => 'slug', 'terms' => $_GET[$taxonomy_name], 'operator' => 'IN' ); } } // Filteren op merk if (isset($_GET['brand'])) { $tax_query[] = array( 'taxonomy' => 'brand', 'field' => 'slug', 'terms' => $_GET['brand'], 'operator' => 'IN' ); } // Stel het aantal producten per pagina in $query->set('posts_per_page', 16); } } add_action('pre_get_posts', 'apply_custom_filters'); function load_custom_scripts() { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_style('jquery-ui-slider-css', '//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css'); } add_action('wp_enqueue_scripts', 'load_custom_scripts'); function enqueue_sortable_script() { wp_enqueue_script('jquery-ui-sortable'); wp_enqueue_script('custom-admin-script', get_template_directory_uri() . '/js/custom-admin.js', array('jquery', 'jquery-ui-sortable'), false, true); } add_action('admin_enqueue_scripts', 'enqueue_sortable_script'); add_action('admin_menu', 'custom_filters_menu'); function custom_filters_menu() { add_submenu_page( 'edit.php?post_type=product', 'Filters', 'Filters', 'manage_options', 'custom-filters', 'custom_filters_page' ); } function custom_filters_page() { // Get product categories $categories = get_terms(array( 'taxonomy' => 'product_cat', 'hide_empty' => false, )); ?> <div class="wrap"> <h1><?php _e('Product Filters Settings', 'textdomain'); ?></h1> <form method="post" action="options.php"> <?php settings_fields('custom_filters_settings_group'); ?> <?php do_settings_sections('custom_filters_settings_group'); ?> <div class="form-table"> <?php foreach ($categories as $category) : ?> <div class="category-section"> <h2><?php echo esc_html($category->name); ?></h2> <div> <?php $filter_order = get_option('filter_order_' . $category->term_id, 'price,brand,size'); $filters_visibility = get_option('filters_visibility_' . $category->term_id, array( 'price' => 1, 'brand' => 1, 'size' => 1 )); // Ensure filters_visibility is an array if (!is_array($filters_visibility)) { $filters_visibility = array( 'price' => 1, 'brand' => 1, 'size' => 1 ); } $attributes = wc_get_attribute_taxonomies(); ?> <ul class="sortable" id="sortable_<?php echo $category->term_id; ?>"> <?php foreach ($attributes as $attribute) : $taxonomy = wc_attribute_taxonomy_name($attribute->attribute_name); ?> <li id="<?php echo $taxonomy; ?>"> <label> <input type="checkbox" name="filters_visibility_<?php echo $category->term_id; ?>[<?php echo $taxonomy; ?>]" value="1" <?php checked(isset($filters_visibility[$taxonomy]) ? $filters_visibility[$taxonomy] : 0, 1); ?> /> <?php echo esc_html($attribute->attribute_label); ?> </label> </li> <?php endforeach; ?> </ul> <input type="hidden" class="filter-order-input" name="filter_order_<?php echo esc_attr($category->term_id); ?>" value="<?php echo esc_attr($filter_order); ?>" /> </div> </div> <?php endforeach; ?> </div> <?php submit_button(); ?> </form> </div> <script> jQuery(document).ready(function($) { $('.sortable').sortable({ update: function(event, ui) { var order = $(this).sortable('toArray').toString(); $(this).siblings('.filter-order-input').val(order); } }); $('.sortable').disableSelection(); }); </script> <?php } add_action('admin_init', 'register_custom_filters_settings'); function register_custom_filters_settings() { $categories = get_terms(array( 'taxonomy' => 'product_cat', 'hide_empty' => false, )); foreach ($categories as $category) { register_setting('custom_filters_settings_group', 'filter_order_' . $category->term_id); register_setting('custom_filters_settings_group', 'filters_visibility_' . $category->term_id, array( 'type' => 'array', 'sanitize_callback' => 'custom_sanitize_filters_visibility' )); } } function custom_sanitize_filters_visibility($input) { $output = array(); foreach ($input as $key => $value) { $output[$key] = intval($value); } return $output; } add_filter('woocommerce_product_query_tax_query', 'custom_product_query_tax_query', 10, 2); function custom_product_query_tax_query($tax_query, $query) { if (isset($_GET['pa_diagonaal-van-het-scherm-cm'])) { $tax_query[] = array( 'taxonomy' => 'pa_diagonaal-van-het-scherm-cm', 'field' => 'slug', 'terms' => $_GET['pa_diagonaal-van-het-scherm-cm'], 'operator' => 'IN', ); } return $tax_query; } add_filter('woocommerce_layered_nav_counts', 'custom_layered_nav_counts', 10, 2); function custom_layered_nav_counts($counts, $taxonomy) { global $wpdb; // Get the current category or brand $queried_object = get_queried_object(); $current_term_id = $queried_object->term_id; // Get the current filtered product IDs $query = new WP_Query(array( 'post_type' => 'product', 'posts_per_page' => -1, 'post_status' => 'publish', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => $queried_object->taxonomy, 'field' => 'term_id', 'terms' => $current_term_id, ), WC()->query->get_main_tax_query(), ), 'meta_query' => WC()->query->get_meta_query(), 'fields' => 'ids' )); $product_ids = $query->posts; if (!empty($product_ids)) { // Loop through each term in the taxonomy and count the products foreach ($taxonomy->get_terms() as $term) { $count = $wpdb->get_var($wpdb->prepare(" SELECT COUNT(DISTINCT p.ID) FROM {$wpdb->posts} p INNER JOIN {$wpdb->term_relationships} tr ON (p.ID = tr.object_id) INNER JOIN {$wpdb->term_taxonomy} tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE p.post_type = 'product' AND p.post_status = 'publish' AND tt.taxonomy = %s AND tt.term_id = %d AND p.ID IN (" . implode(',', $product_ids) . ") ", $taxonomy->taxonomy, $term->term_id)); // Add the new count to the array $counts[$term->term_id] = $count; } } else { foreach ($taxonomy->get_terms() as $term) { $counts[$term->term_id] = 0; } } return $counts; } ?> 您可以在这里测试: https://waaaauw.be/product-categorie/tv-video-en-thuisbioscoop-tv-s/ 问题描述 选择过滤器属性 发出动态属性计数 正如你所看到的,当我为 example 106,7 cm (4) 选择时,它应该说“品牌”(这是一个分类法,而不是一个属性): 松下 (1) LG (3) 属性也应该是动态的,例如 energie 类一直说: A (2) D (8) E (109) F (164) G(202) 应该说 E (4) - 示例 所以计数器不是动态工作的。我几乎被困在这里,因为我看不到我做错了什么。 当您按下“品牌”时,过滤器也会删除: 品牌删除过滤器 您可以在此提供的链接上进行实时测试。 发现问题修复: // Altijd de productcategorie ID ophalen (bijvoorbeeld via een URL-parameter of andere logica) if (isset($_GET['product_cat'])) { $current_product_cat_slug = sanitize_text_field($_GET['product_cat']); $current_product_cat = get_term_by('slug', $current_product_cat_slug, 'product_cat'); if ($current_product_cat) { $current_product_cat_id = $current_product_cat->term_id; } } else { // Als er geen specifieke categorie is gekozen, gebruik dan de huidige term ID $current_product_cat_id = $current_term_id; } // Debug log om de gebruikte productcategorie ID te controleren error_log('Geselecteerde productcategorie ID: ' . $current_product_cat_id); // Gebruik altijd de productcategorie ID om de zichtbaarheid van de attributenfilters op te halen if ($current_product_cat_id) { $filters_visibility = get_option('filters_visibility_' . $current_product_cat_id, array()); // Testwaarde toevoegen om te controleren of de optie correct wordt opgehaald if (empty($filters_visibility)) { // Voeg een testwaarde toe $filters_visibility = array('pa_diagonaal-van-het-scherm-cm' => 1, 'pa_energieklasse' => 1); update_option('filters_visibility_' . $current_product_cat_id, $filters_visibility); error_log('Testwaarde ingesteld voor productcategorie ' . $current_product_cat_id); } error_log('Filters zichtbaarheid voor productcategorie ' . $current_product_cat_id . ': ' . print_r($filters_visibility, true)); } else { $filters_visibility = array(); } // Controleer of de filters_visibility een array is en niet leeg if (is_array($filters_visibility) && !empty($filters_visibility)) { error_log('Filters zichtbaarheid (eindresultaat): ' . print_r($filters_visibility, true)); } else { error_log('Filters zichtbaarheid is leeg of geen array voor productcategorie ' . $current_product_cat_id); $filters_visibility = array(); } // Zorg ervoor dat de filters_visibility een array is if (!is_array($filters_visibility)) { $filters_visibility = array(); } // Debug log om de definitieve filters zichtbaarheid te controleren error_log('Definitieve filters zichtbaarheid: ' . print_r($filters_visibility, true)); 此代码进行了更改: // Testwaarde toevoegen om te controleren of de optie correct wordt opgehaald if (empty($filters_visibility)) { // Voeg een testwaarde toe $filters_visibility = array('pa_diagonaal-van-het-scherm-cm' => 1, 'pa_energieklasse' => 1); update_option('filters_visibility_' . $current_product_cat_id, $filters_visibility); error_log('Testwaarde ingesteld voor productcategorie ' . $current_product_cat_id); }

回答 1 投票 0

在 WooCommerce 中将产品添加到购物车时,我收到“抱歉出现问题,请重试”

在 WooCommerce 中将产品添加到购物车时,我收到“抱歉出现问题,请重试”。昨天问题解决了,今天又出现了。我正在寻求您的帮助...

回答 1 投票 0

向 WooCommerce 显示的产品价格添加多个后缀

我一直在尝试找到一种方法来为我的零售价和销售价添加不同的后缀。 我要销售石头,我希望我的产品页面显示以下内容...... $12.99...

回答 2 投票 0

创建本地网络,允许两部分在无互联网区域进行通信

我找到了项目外包名称:OpenHD。他们建立了一个本地网络,允许地面装置连接到空中装置(无人机),从而启用诸如 Qground 之类的应用程序,任务规划器可以查看所有内容...

回答 1 投票 0

在WooCommerce单品页面显示具体的产品属性描述

我有属性“详细信息”和该属性的值之一 - “超大”。该值有描述“请注意,该型号偏大。我们建议订购尺码

回答 1 投票 0

从品牌和类别自定义下拉列表中过滤 WooCommerce 产品

我正在尝试创建 2 个下拉菜单,一个用于 WooCommerce 插件的 Perfect Brands 品牌,另一个用于二级产品类别。该品类可以独立运作,但品牌只是回归......

回答 1 投票 0

在 Woocommerce 单一产品页面中显示特定产品标签的自定义内容

我使用下面的内容在 WooCommerce 单一产品页面中添加自定义 html 或文本,简短描述后: 函数 my_content( $content ) { $内容.=' 在简短描述后,我使用以下内容在 WooCommerce 单个产品页面中添加自定义 html 或文本: function my_content( $content ) { $content .= '<div class="custom_content">Custom content!</div>'; return $content; } add_filter('woocommerce_short_description', 'my_content', 10, 2); 如何在包含特定产品标签的产品页面上限制此功能(不是产品类别)? 您可以使用 has_term() WordPress 条件函数,限制您的自定义内容仅针对具有特定产品标签的产品显示,如下所示 (在函数中定义您的产品标签术语) )): add_filter('woocommerce_short_description', 'my_content', 10, 2); function my_content( $content ) { // Here define your specific product tag terms (can be Ids, slugs or names) $product_tags = array( 'Garden', 'Kitchen' ); if( has_term( $product_tags, 'product_tag', get_the_ID() ) ) { $content .= '<div class="custom_content">' . __("Custom text!", "") . '</div>'; } return $content; } 代码位于活动子主题(或活动主题)的functions.php 文件中。应该有效。 对于产品类别: 将 'product_tag' 替换为 'product_cat'

回答 1 投票 0

将评论移至 Woocommerce 中的追加销售和交叉销售部分下方

我正在使用 woocommerce 插件。我目前使用 Faview 插件进行产品虚拟评论,然后是相关产品,完成设置,您可能还喜欢产品详细信息部分...

回答 1 投票 0

在 WooCommerce 中库存变化时自动更改产品标签

我有一家 WooCommerce 商店,我每天都会查看电子邮件,其中列出了所有库存不足的产品。 因此,如果我看到其中一种产品,我会登录,找到该产品,然后将标签更改为“最后...”

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.