540, 'single_image_width' => 720, 'product_grid' => array( 'default_rows' => 3, 'min_rows' => 1, 'max_rows' => 6, 'default_columns' => 3, 'min_columns' => 2, 'max_columns' => 5, ), ) ); } add_action( 'after_setup_theme', 'bongoto_woocommerce_setup' ); /** 2) Replace WC wrappers + remove default sidebar */ function bongoto_wc_remove_default_wrappers() { if ( ! bongoto_is_woo_active() ) return; remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); } add_action( 'after_setup_theme', 'bongoto_wc_remove_default_wrappers', 20 ); function bongoto_wc_wrapper_start(){ echo '
'; } function bongoto_wc_wrapper_end(){ echo '
'; } add_action( 'woocommerce_before_main_content', 'bongoto_wc_wrapper_start', 10 ); add_action( 'woocommerce_after_main_content', 'bongoto_wc_wrapper_end', 10 ); /** 3) Shop grid safety inline (can keep) */ function bongoto_woocommerce_shop_inline_css() { if ( ! bongoto_is_woo_active() ) return; $css = <<cart ) ? (int) WC()->cart->get_cart_contents_count() : 0; ?> is_purchasable() ) return; $buy_url = add_query_arg( array( 'add-to-cart' => $product->get_id(), 'buy-now' => '1', ), home_url( '/' ) ); // Use Woo button classes so style matches Add to cart. // You can keep your extra class for targeting if needed. printf( '%2$s', esc_url( $buy_url ), esc_html__( 'Buy Now', 'bongoto' ) ); } // Place exactly after the Add to cart button. add_action( 'woocommerce_after_add_to_cart_button', 'bongoto_print_buy_now_button', 10 ); /** * (Optional) Tiny inline critical style so both buttons look same at first paint. * Keeps UI steady while the rest of CSS loads. */ function bongoto_single_btns_critical_css() { if ( ! is_product() ) return; $css = <<