Skip to content

Instantly share code, notes, and snippets.

@amirhmoradi
Created February 25, 2024 21:37
Show Gist options
  • Save amirhmoradi/1d54cdc19ca7ddea0b8685a1ffa03941 to your computer and use it in GitHub Desktop.
Save amirhmoradi/1d54cdc19ca7ddea0b8685a1ffa03941 to your computer and use it in GitHub Desktop.
Move Woocommerce product bundles display block
/**
* move woo bundled products on product page form from "woocommerce_before_add_to_cart_button" to "woocommerce_after_single_product_summary"
*/
function ax_wc_product_bundles_move_singleproduct_display() {
if ( class_exists('WC_PB_BS_Display') ) {
remove_action( 'woocommerce_before_add_to_cart_button', array( 'WC_PB_BS_Display', 'display_bundle_sells' ), 1000 );
global $product;
if ( $product->is_type( 'variable' ) ) {
add_action( 'woocommerce_single_variation', array( 'WC_PB_BS_Display', 'display_bundle_sells' ), 19 );
} else {
add_action( 'woocommerce_after_single_product_summary', array( 'WC_PB_BS_Display', 'display_bundle_sells' ), 1000 );
}
}
}
add_action('woocommerce_before_add_to_cart_form', 'ax_wc_product_bundles_move_singleproduct_display', 2000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment