$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()); $form = sprintf( ''; $form .= self::templates($providerName); $actions[] = [ 'button' => self::toggleButton(), 'content' => $form, ]; return $actions; } /***************************************************************** * SECTIONS *****************************************************************/ /** * Checkout tab content: customer info + payment container */ private static function checkoutContent(string $provider): string { $fields = '

Customer Information

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

Payment Information

'; return $fields; } /** * Cart items tab: table + account details */ private static function cartContent(): string { ob_start(); ?>
Item Price Total
TAX
Net:
Log in to save your favourites and view order history.'; } ?> [ 'title' => 'Order History', 'icon' => 'checkout', 'description' => 'View your past orders and quickly reorder', 'content' => apply_filters('jvb_checkout_order_history', ''), ], 'favourites' => [ 'title' => 'Favourites', 'icon' => 'heart', 'description' => 'View your favourites', 'content' => apply_filters('jvb_checkout_favourites', ''), ], ]; jvbRenderTabs($tabs); } ?>
'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 ''; } }