public function CompletionRegister::isVisible in Commerce Core 8.2
Determines whether the pane is visible.
Return value
bool TRUE if the pane is visible, FALSE otherwise.
Overrides CheckoutPaneBase::isVisible
File
- modules/
checkout/ src/ Plugin/ Commerce/ CheckoutPane/ CompletionRegister.php, line 142
Class
- CompletionRegister
- Provides the registration after checkout pane.
Namespace
Drupal\commerce_checkout\Plugin\Commerce\CheckoutPaneCode
public function isVisible() {
// This pane can only be shown at the end of checkout.
if ($this->order
->getState()->value == 'draft') {
return FALSE;
}
if ($this->currentUser
->isAuthenticated()) {
return FALSE;
}
$mail = $this->order
->getEmail();
if (!$mail) {
// An email is required, but wasn't collected.
return FALSE;
}
$existing_user = $this->userStorage
->loadByProperties([
'mail' => $mail,
]);
if ($existing_user) {
// The anonymous customer already has an account on the site.
return FALSE;
}
return TRUE;
}