$active) { if (in_array($integration, ['square', 'helcim']) && $active) { return JVB()->connect($integration); } } return false; } /** * Render the checkout aside and append to actions. * * Hooked via: add_filter('jvbAdditionalActions', [Checkout::class, 'render']) */ public static function render(array $actions): array { if (is_singular(BASE . 'dash') || is_post_type_archive(BASE . 'dash')) { return $actions; } $provider = self::getProvider(); if (!$provider || !$provider->isSetUp()) { return $actions; } $providerName = strtolower($provider->getServiceName()); $aside = ''; $aside .= self::templates($providerName); $actions[] = [ 'button' => self::toggleButton(), 'content' => $aside, ]; return $actions; } /***************************************************************** * SECTIONS *****************************************************************/ /** * Checkout tab content: customer info + payment container */ private static function checkoutContent(string $provider): string { $name = $email = $phone = ''; if (is_user_logged_in()) { $meta = Meta::forUser(get_current_user_id()); if ($meta) { $name = $meta->get('display_name'); $email = $meta->get('user_email'); $phone = $meta->get('phone'); } } $form = sprintf( '

Your Information

%s%s%s', Form::render('cart_name', $name, [ 'type' => 'text', 'label' => 'Your Name', 'required' => true, 'autocomplete' => 'name', ]), Form::render('cart_email', $email, [ 'type' => 'email', 'label' => 'Your Email', 'required' => true, 'autocomplete' => 'email', ]), Form::render('cart_phone', $phone, [ 'type' => 'tel', 'label' => 'Your Phone', 'required' => true, 'autocomplete' => 'phone', ]) ); // Optional sections — integrations can add pickup, scheduling, etc. $form .= apply_filters('jvb_checkout_fields', '', $provider); // Payment section — provider JS mounts its own UI inside #payment-container $form .= '

Payment Information

'; return $form; } /** * Cart items tab: table + account details */ private static function cartContent(string $provider): string { $content = sprintf('
', esc_attr($provider) ); $content.= '
Item Price Total
TAX
Net:
'; return $content; } /** * Order confirmation / status tracking */ private static function orderStatus(): string { $statuses = apply_filters('jvb_checkout_order_statuses', [ 'received' => 'Order Received', 'preparing' => 'Preparing', 'ready' => 'Ready for Pickup', ]); ob_start(); ?>

Order Confirmed!

Order #

$label): ?>
Estimated pickup: Calculating...

Looks like we left things hanging

We\'ve restored your cart from your last session below.

If you\'d rather start over, click the button below.

'; } /** * Cart toggle button */ private static function toggleButton(): string { return ''; } }