Comments 7Alvaro started the conversationJanuary 5, 2022 at 5:06amI have some products on my site, which are bundles or wholesale, so i would like to disable bought together on those. 767Janilyn repliedJanuary 5, 2022 at 9:37amHi Alvaro, Thank you for contacting WPClever Support Forum. We’ve received your ticket and assigned one of our developers to help you with that. He’ll be looking into your question and responding with specific instructions as soon as possible. Please stay patient as we're having very heavy workloads, it might take some time for our developers to reach back. Best regards.Janilyn T. - WPClever Support Agent1 Like 1,226Dustin repliedJanuary 6, 2022 at 2:48amHi Alvaro,Please follow these steps:1. Update our plugin to the latest version 4.1.22. Add the below custom code (How to add custom code?) add_filter( 'woobt_show_items', 'woobt_hide_for_some_products', 99, 2 ); function woobt_hide_for_some_products( $items, $product_id ) { // product IDs that you want to hide frequetly bought together $ids = array( 1906, 1992, 2000, 2022 ); if ( in_array( $product_id, $ids, true ) ) { return false; } return $items; }You can change the product IDs (1906, 1992, 2000, 2022) in this snippet as you want.Best regards,Dustin1 Like 7Alvaro repliedJanuary 7, 2022 at 6:14pmThanks Dustin!I used to make a better usable solution:// Hide related products from the single product edit page// 1. Add new checkbox product edit pageadd_action( 'woocommerce_product_options_related', 'checkbox_sacar_relacionado' ); function checkbox_sacar_relacionado() { woocommerce_wp_checkbox( array( 'id' => 'hide_related', 'class' => '', 'label' => 'Esconde los productos relacionados' ) ); } // 2. Save checkbox into custom field add_action( 'save_post_product', 'guardar_opcion_esconder' );function guardar_opcion_esconder( $product_id ) { global $pagenow, $typenow; if ( 'post.php' !== $pagenow || 'product' !== $typenow ) return; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( isset( $_POST['hide_related'] ) ) { update_post_meta( $product_id, 'hide_related', $_POST['hide_related'] ); } else delete_post_meta( $product_id, 'hide_related' );} // 3. Hide related products @ single product pageadd_filter( 'woobt_show_items', 'woobt_hide_for_some_products', 99, 2 );function woobt_hide_for_some_products( $items, $product_id ) { if ( ! empty( get_post_meta($product_id, 'hide_related', true ) ) ) { return false; } return $items;}1 Like 7Alvaro repliedJanuary 7, 2022 at 7:20pmand this for categories:add_filter( 'woobt_show_items', 'woobt_hide_for_some_products', 99, 2 );function woobt_hide_for_some_products( $items, $product_id ) { if( has_term( array( 'six-pack', 'backpacks' ), 'product_cat', $product_id)) { return false; } return $items;}1 Like Sign in to reply ...
I have some products on my site, which are bundles or wholesale, so i would like to disable bought together on those.
Hi Alvaro,
Thank you for contacting WPClever Support Forum.
We’ve received your ticket and assigned one of our developers to help you with that.
He’ll be looking into your question and responding with specific instructions as soon as possible.
Please stay patient as we're having very heavy workloads, it might take some time for our developers to reach back.
Best regards.
Janilyn T. - WPClever Support Agent
Hi Alvaro,
Please follow these steps:
1. Update our plugin to the latest version 4.1.2
2. Add the below custom code (How to add custom code?)
You can change the product IDs (1906, 1992, 2000, 2022) in this snippet as you want.
Best regards,
Dustin
Thanks Dustin!
I used to make a better usable solution:
// Hide related products from the single product edit page
// 1. Add new checkbox product edit page
add_action( 'woocommerce_product_options_related', 'checkbox_sacar_relacionado' );
function checkbox_sacar_relacionado() {
woocommerce_wp_checkbox( array(
'id' => 'hide_related',
'class' => '',
'label' => 'Esconde los productos relacionados'
)
);
}
// 2. Save checkbox into custom field
add_action( 'save_post_product', 'guardar_opcion_esconder' );
function guardar_opcion_esconder( $product_id ) {
global $pagenow, $typenow;
if ( 'post.php' !== $pagenow || 'product' !== $typenow ) return;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if ( isset( $_POST['hide_related'] ) ) {
update_post_meta( $product_id, 'hide_related', $_POST['hide_related'] );
} else delete_post_meta( $product_id, 'hide_related' );
}
// 3. Hide related products @ single product page
add_filter( 'woobt_show_items', 'woobt_hide_for_some_products', 99, 2 );
function woobt_hide_for_some_products( $items, $product_id ) {
if ( ! empty( get_post_meta($product_id, 'hide_related', true ) ) ) {
return false;
}
return $items;
}
and this for categories:
add_filter( 'woobt_show_items', 'woobt_hide_for_some_products', 99, 2 );
function woobt_hide_for_some_products( $items, $product_id ) {
if( has_term( array( 'six-pack', 'backpacks' ), 'product_cat', $product_id)) {
return false;
}
return $items;
}