You are here

public function AddressBookInterface::load in Commerce Core 8.2

Loads the customer's profile.

Takes the default profile, if found. Otherwise falls back to the newest published profile.

Primarily used for profile types which only allow a single profile per user.

Ensures that the loaded profile is available, by filtering it against $available_countries. If the loaded profile is not available, NULL will be returned instead.

Parameters

\Drupal\user\UserInterface $customer: The customer.

string $profile_type_id: The profile type ID.

array $available_countries: List of country codes. If empty, all countries will be available.

Return value

\Drupal\profile\Entity\ProfileInterface|null The profile, or NULL if none found.

1 method overrides AddressBookInterface::load()
AddressBook::load in modules/order/src/AddressBook.php
Loads the customer's profile.

File

modules/order/src/AddressBookInterface.php, line 100

Class

AddressBookInterface
Represents a customer's address book.

Namespace

Drupal\commerce_order

Code

public function load(UserInterface $customer, $profile_type_id, array $available_countries = []);