I have installed Woocommerce Bookings plugin with Woocommerce Plugin. I have also created a custom plugin in which i want to add the booking to the cart at the end for default way of checkout process. How can it be possible to add my bookable product to add to the cart and then checkout with the payment gateway used?
0
votes
1 Answers
0
votes
You can create custom product type having it's own custom fields for this. Paste the below code in your functions.php, try to create a product there will be another product type called Booking Product. you may get some idea.
// add a product type
add_filter( 'product_type_selector', 'wdm_add_custom_product_type' );
function wdm_add_custom_product_type( $types ){
$types[ 'booking_product' ] = __( 'Booking Product' );
return $types;
}
add_action( 'plugins_loaded', 'wdm_create_custom_product_type' );
function wdm_create_custom_product_type(){
// declare the product class
class WC_Product_Wdm extends WC_Product{
public function __construct( $product ) {
$this->product_type = 'booking_product';
parent::__construct( $product );
// add additional functions here
}
}
}