我只是想知道如何通过一点逆向工程来做到这一点,希望这能帮助一些人:
$availability = array();
$availability[0][\'type\'] = \'time:range\';
$availability[0][\'bookable\'] = \'yes\';
//Default priority
$availability[0][\'priority\'] = 10;
//case \'time:range\'
$availability[0][\'from\'] = wc_booking_sanitize_time( $hours );
$availability[0][\'to\'] = wc_booking_sanitize_time( $hours );
$availability[0][\'from_date\'] = wc_clean( $date );
$availability[0][\'to_date\'] = wc_clean( $date );
add_post_meta( $product_ID, \'_wc_booking_availability\', $availability );