Home Forums WoodMart support forum remove price for "related products"

remove price for "related products"

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #125709

    novahex
    Participant

    Hello, 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.
    #125775

    Hello,

    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

    #125840

    novahex
    Participant

    Sure:
    This is the category link
    Thanks.

    #125877

    Hello,

    Now the category page does not have any prices https://gyazo.com/e3fd84bbf70cf09db424d8e7ff7a752d

    Perhaps you switched the catalog mode on.

    Best Regards

Viewing 4 posts - 1 through 4 (of 4 total)