Home › Forums › WoodMart support forum › remove price for "related products"
remove price for "related products"
- This topic has 3 replies, 2 voices, and was last updated 5 years, 5 months ago by Elise Noromit.
-
AuthorPosts
-
May 25, 2019 at 1:37 pm #125709
novahexParticipantHello, I have a specific category who I don’t want to sell the products, but I need to show it anyway.
So I added a code in function.php and works (don’t show price filtered by “slug”) but if I enter in product page there (on page footer) I can see the prices (for same category) (see capture) on “related products”.it’s possible to hide that too?
this the code to hide by “slug” (in this case slug=”capsulas”)
// Specific product category archive pages add_action( 'woocommerce_after_shop_loop_item_title', 'hide_loop_product_prices', 1 ); function hide_loop_product_prices(){ global $product; if( is_product_category('capsulas') ): // Hide prices remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); // Hide add-to-cart button remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart', 30 ); endif; } // Single product pages add_action( 'woocommerce_single_product_summary', 'hide_single_product_prices', 1 ); function hide_single_product_prices(){ global $product; if( has_term( 'capsulas', 'product_cat', $product->get_id() ) ): // Hide prices remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); // Hide add-to-cart button, quantity buttons (and attributes dorpdowns for variable products) if( ! $product->is_type('variable') ){ remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30 ); } else { remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 ); } endif; }
I don’t sure if this exactly are cover by customer support but, it’s no problem if not.
Thanks so much anyway!Attachments:
You must be logged in to view attached files.May 26, 2019 at 8:29 am #125775
Elise NoromitMemberHello,
We do not know how this code should work.
Please provide the category URL we shall check if it is possible to hide the price with the custom CSS.
Best Regards
May 27, 2019 at 1:22 am #125840
novahexParticipantSure:
This is the category link
Thanks.May 27, 2019 at 7:37 am #125877
Elise NoromitMemberHello,
Now the category page does not have any prices https://gyazo.com/e3fd84bbf70cf09db424d8e7ff7a752d
Perhaps you switched the catalog mode on.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register