• Resolved coffeecreative

    (@coffeecreative)


    Hi there,

    We are currently using your plugin on a site that makes use of a custom post type called product. We had the Woocommerce functionality disabled to avoid errors, however still got one when it is trying to access the global $product object, and fails on method exits.

    We have included a line to check if it is an array – to avoid a critical error.

    public function wp_footer(){
            global $product;
            if(is_array($product)){
                return;
            }
            if(!$product || !method_exists( $product, 'get_id')){
                return;
            }
            $modelData = get_post_meta( $product->get_id(), '_bp3d_product_', true );
            $viewer_position = isset($modelData['viewer_position']) ? $modelData['viewer_position'] : '';
    
            if($viewer_position === 'custom_selector'){
                $finalData = $this->getProductAttributes($modelData); ?>
    
                <div data-selector='<?php echo esc_attr($modelData['custom-selector'] ?? '') ?>' class="modelViewerBlock wooCustomSelector" data-attributes='<?php echo esc_attr(wp_json_encode($finalData)); ?>'></div>
    
                <?php
                 wp_enqueue_script('bp3d-front-end');
                 wp_enqueue_style('bp3d-custom-style');
                 wp_enqueue_style('bp3d-public');
            }
    
        }
Viewing 1 replies (of 1 total)
  • Plugin Author shehabulislam

    (@shehabulislam)

    HI

    Thanks for your suggetions. we fixed the issue and release a new version.

    Thank you

Viewing 1 replies (of 1 total)
  • The topic ‘Code suggestion’ is closed to new replies.