You are here

public function WishlistStorage::loadByCode in Commerce Wishlist 8.3

Loads the wishlist for the given code.

Parameters

string $code: The code.

Return value

\Drupal\commerce_wishlist\Entity\WishlistInterface|null The wishlist, or NULL if none found.

Overrides WishlistStorageInterface::loadByCode

File

src/WishlistStorage.php, line 16

Class

WishlistStorage
Defines the wishlist storage.

Namespace

Drupal\commerce_wishlist

Code

public function loadByCode($code) {
  $wishlists = $this
    ->loadByProperties([
    'code' => $code,
  ]);
  $wishlist = reset($wishlists);
  return $wishlist ?: NULL;
}