can_use_builder_widgets()) { return false; } // In editor mode editing checkout template if (class_exists('King_Addons\\Woo_Builder\\Context') && Woo_Context::is_editing_template_type('checkout')) { return true; } // On actual checkout page if (function_exists('is_checkout') && is_checkout() && !is_order_received_page()) { return true; } return false; } /** * Cart / checkout / account builder widgets are a Pro feature. * * @return bool */ protected function can_use_builder_widgets(): bool { return function_exists('king_addons_can_use_pro') && king_addons_can_use_pro(); } /** * Render placeholder when checkout context is missing. * * @return void */ protected function render_missing_checkout_notice(): void { if (!class_exists('\Elementor\Plugin') || !\Elementor\Plugin::$instance->editor->is_edit_mode()) { return; } if (!$this->can_use_builder_widgets()) { $this->render_pro_required_notice(); return; } // Check if we're editing a Checkout template if (class_exists('King_Addons\\Woo_Builder\\Context') && Woo_Context::is_editing_template_type('checkout')) { // Don't show notice - we're in the right template type return; } echo '
' . esc_html__('This widget works only on the WooCommerce checkout page.', 'king-addons') . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Editor-only upsell when the site cannot use Pro. * * @return void */ protected function render_pro_required_notice(): void { if (class_exists('King_Addons\\Core')) { Core::renderEditorHint(esc_html__('Available in King Addons Pro.', 'king-addons')); return; } echo '
' . esc_html__('Available in King Addons Pro.', 'king-addons') . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } }