ID ) ) { return; } $this->step_data = get_post_meta( $post->ID, 'step_data', true ); } /** * It's used for getting product object data which was defined in funnels panel. * * @return false|WC_Product */ public function get_product_object() { if ( empty( $this->step_data['data']['products']['list'] ) || count( $this->step_data['data']['products']['list'] ) === 0 ) { return false; } $products = $this->step_data['data']['products']['list']; $product_id = key( $products ); return wc_get_product( $product_id ); } /** * Only show the widgets when the page is an upsell page. * * @return bool */ public function show_in_panel() { if ( empty( $this->step_data['type']['key'] ) ) { return false; } if ( 'upsell' !== $this->step_data['type']['key'] ) { return false; } return true; } }