categories

Hide Price based on product category in Woocommerce

六月ゝ 毕业季﹏ 提交于 2020-08-07 07:14:29
问题 In Woocommerce I am trying to hide the product on the archive page and single product page based on category however the condition does not appear to work and just hide all the price whether I set the category or not add_filter( 'woocommerce_variable_sale_price_html', 'woocommerce_remove_prices', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'woocommerce_remove_prices', 10, 2 ); add_filter( 'woocommerce_get_price_html', 'woocommerce_remove_prices', 10, 2 ); function woocommerce

Woocommerce: Only show related products from same subcategory

…衆ロ難τιáo~ 提交于 2020-08-03 01:56:40
问题 Related products is a section that pulls other products from your store that share the same tags or categories as the current product. src: Woocommerce Docs Lets say I sell tables (and other items) in my store. Tables is a category. I have 3 subcategorys that go with the table category: Small, Medium and Large. What I want: when you click on a small table. The related products should only show small tables. What it does: When you click on a small table. The related products shows a table from

Woocommerce: Only show related products from same subcategory

雨燕双飞 提交于 2020-08-03 01:56:30
问题 Related products is a section that pulls other products from your store that share the same tags or categories as the current product. src: Woocommerce Docs Lets say I sell tables (and other items) in my store. Tables is a category. I have 3 subcategorys that go with the table category: Small, Medium and Large. What I want: when you click on a small table. The related products should only show small tables. What it does: When you click on a small table. The related products shows a table from

How do I get the parent category name in WordPress template? And can I query post by the parent category?

邮差的信 提交于 2020-07-29 06:51:38
问题 I tried getting help on the WordPress forums but no luck. Anyways, here is my question... Lets say I am creating 10 parent categories and 2 sub categories to each parent. My WordPress post belongs to one sub category of a particular parent category How do I get the parent category name ONLY? I don't want subcategories names? what WordPress code would do that? And one more question... Is it possible to query post by the parent of a sub category by using: but instead of entering cat=1 or the

How do I get the parent category name in WordPress template? And can I query post by the parent category?

不羁的心 提交于 2020-07-29 06:48:12
问题 I tried getting help on the WordPress forums but no luck. Anyways, here is my question... Lets say I am creating 10 parent categories and 2 sub categories to each parent. My WordPress post belongs to one sub category of a particular parent category How do I get the parent category name ONLY? I don't want subcategories names? what WordPress code would do that? And one more question... Is it possible to query post by the parent of a sub category by using: but instead of entering cat=1 or the

How do I get the parent category name in WordPress template? And can I query post by the parent category?

别说谁变了你拦得住时间么 提交于 2020-07-29 06:46:27
问题 I tried getting help on the WordPress forums but no luck. Anyways, here is my question... Lets say I am creating 10 parent categories and 2 sub categories to each parent. My WordPress post belongs to one sub category of a particular parent category How do I get the parent category name ONLY? I don't want subcategories names? what WordPress code would do that? And one more question... Is it possible to query post by the parent of a sub category by using: but instead of entering cat=1 or the

Woocommerce - Display Featured Products at top of Category Page

烂漫一生 提交于 2020-07-14 10:59:31
问题 I want to have a section at the top of each product category page that shows three featured products at random from that category. Beneath this would be the regular archive loop. What's the best way to achieve this, without using a plugin? 回答1: Below code can help you: add_filter('posts_orderby', 'show_featured_products_orderby',10,2); function show_featured_products_orderby($order_by, $query){ global $wpdb ; if( ($query->get('post_type')=='product') && (!is_admin()) ){ $orderby_value = (

Add content in between product rows in WooCommerce archives

∥☆過路亽.° 提交于 2020-07-13 07:21:00
问题 I want to show some content after the third product (and maybe the sixth, ninth...) of a product category. Not every category has that extra content or the same amount of it. So it should be flexible. I found an example which uses the following code : <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'template-parts/content' ); ?> <?php if ( $wp_query->current_post == 1 ) { ?> <div>Put Ad Here</div> <?php } ?> <?php endwhile; endif; ?> I added that

Add content in between product rows in WooCommerce archives

感情迁移 提交于 2020-07-13 07:16:21
问题 I want to show some content after the third product (and maybe the sixth, ninth...) of a product category. Not every category has that extra content or the same amount of it. So it should be flexible. I found an example which uses the following code : <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'template-parts/content' ); ?> <?php if ( $wp_query->current_post == 1 ) { ?> <div>Put Ad Here</div> <?php } ?> <?php endwhile; endif; ?> I added that

Add content in between product rows in WooCommerce archives

大憨熊 提交于 2020-07-13 07:13:58
问题 I want to show some content after the third product (and maybe the sixth, ninth...) of a product category. Not every category has that extra content or the same amount of it. So it should be flexible. I found an example which uses the following code : <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'template-parts/content' ); ?> <?php if ( $wp_query->current_post == 1 ) { ?> <div>Put Ad Here</div> <?php } ?> <?php endwhile; endif; ?> I added that