Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created October 2, 2026 06:25
Show Gist options
  • Select an option

  • Save plugin-republic/50dacb10fbaf6b8a4d023c9e9ba38efd to your computer and use it in GitHub Desktop.

Select an option

Save plugin-republic/50dacb10fbaf6b8a4d023c9e9ba38efd to your computer and use it in GitHub Desktop.
<?php
/**
* Force Booking products to be treated as shippable (override the plugin's
* hardcoded set_virtual( true ) on WC_Product_Booking), so WooCommerce's own
* shipping logic — including the Blocks/Store API checkout, which doesn't
* reliably respect the bfwc_hide_shipping_fields filter — sees them as
* non-virtual and shows shipping fields.
*/
add_filter( 'woocommerce_product_get_virtual', 'my_bfwc_booking_not_virtual', 10, 2 );
add_filter( 'woocommerce_product_variation_get_virtual', 'my_bfwc_booking_not_virtual', 10, 2 );
function my_bfwc_booking_not_virtual( $virtual, $product ) {
if ( 'simple_booking' === $product->get_type() ) {
return false;
}
return $virtual;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment