Okay
  Public Ticket #2993516
remove upsells or related products
Closed

Comments

  •  45
    Clara started the conversation

    Hi,

    I'm trying to remove upsell or related products to move them, with the following code, but it doesn't work:

    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
    remove_action( 'woocommerce_after_single_product', 'woocommerce_output_related_products', 10 );
    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_upsells', 1 );
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
    remove_action( 'woocommerce_after_single_product', 'woocommerce_output_related_products', 10 );
    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 1 );

    I also tried with:

    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    

    But it didn't work better.

  •  1,877
    Judith replied

    Hi Mjouan,

    Thanks for keeping in touch.

    Please check this out:https://wpza.net/how-to-remove-related-products-and-upsells-in-woocommerce/.

    Thanks.

  •  45
    Clara replied

    Hi,

    I think you didn't read my message. What you propose is exactly what I did. That's the problem...

    Regards,

    Clara

  •  1,877
    Judith replied

    Hi Mjouan,

    Please send in your website url so that we can remove them using a possible css.

    Thanks.

  •  45
    Clara replied

    I know how to hide them using CSS, I'm a web developer, I want to know how to remove them using PHP. Having hidden related products is not good for performance.

  •  1,877
    Judith replied

    Hi Mjouan,

    Is it possible you can send us your admin login credentials so that we can try out from your end please.

    Thanks.

  •   Clara replied privately
  •  1,877
    Judith replied

    Hi Mjouan,

    Please allow me to escalate this to the developer to check it out.

    Thanks.

  •  45
    Clara replied

    Sure, no problem.

  •  1,070
    ThemeNectar replied

    Hey Mjouan,

    The following snippet will remove both related and upsell products:

    add_action('init','salient_child_mod_woo_related');
    function salient_child_mod_woo_related() {
        remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
        remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_upsells', 21 );
    }

    Kind regards,

  •  45
    Clara replied

    Thanks a lot, it works perfectly!! I didn't know I had to wrap it with a function to make it work.

    Great support as always :)