• Resolved sm1984

    (@sm1984)


    Uncaught Error: Call to a member function get_type() on bool in mwb-bookings-for-woocommerce\public\class-mwb-bookings-for-woocommerce-public.php:78 ……………………….

    I am getting this error for every single pages except product page.

    I have checked the code, the errors are coming from because you have used if ( is_single() ). I think you should use like this if ( is_single('product') ).

    Hope you will fix this issue and update very soon.

Viewing 1 replies (of 1 total)
  • Plugin Author WP Swings

    (@wpswings)

    Hello @sm1984

    if ( is_single() ) {
    
                global $post;
    
                $product_id = $post->ID;
    
                $temp_product = wc_get_product( $product_id );
    
                if( ! empty( $temp_product ) ) {
    
    
    
                    if ( 'mwb_booking' == $temp_product->get_type() ) {
    
                        $daily_start_time = get_post_meta( $product_id, 'mwb_mbfw_daily_calendar_start_time', true );
    
                        $daily_end_time = get_post_meta( $product_id, 'mwb_mbfw_daily_calendar_end_time', true );
    
                        $upcoming_holiday = get_post_meta( $product_id, 'mwb_mbfw_choose_holiday', true );
    
                        $upcoming_holiday = gmdate( 'Y-m-d', strtotime( $upcoming_holiday ) );
    
                    }
    
                }
    
    
    
            }

    please use this code from where if( is_single()) code has written

    Regards,

Viewing 1 replies (of 1 total)

The topic ‘Fatal error for Call to a member function get_type()’ is closed to new replies.