Skip to content

Commit

Permalink
Replace getBuyableDescription with getBuyableName for cart item name
Browse files Browse the repository at this point in the history
  • Loading branch information
iainheng committed Jan 23, 2024
1 parent e28cdac commit 0206ce2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public function __get($attribute)
*/
public static function fromBuyable(Buyable $item, array $options = [])
{
return new self($item->getBuyableIdentifier($options), $item->getBuyableDescription($options), $item->getBuyablePrice($options), $item->getBuyableWeight($options), $options);
return new self($item->getBuyableIdentifier($options), $item->getBuyableName($options), $item->getBuyablePrice($options), $item->getBuyableWeight($options), $options);
}

/**
Expand Down
23 changes: 22 additions & 1 deletion src/Contracts/Buyable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ interface Buyable
public function getBuyableIdentifier($options = null);

/**
* Get the description or title of the Buyable item.
* Get the title of the Buyable item.
*
* @return string
*/
public function getBuyableName($options = null);

/**
* Get the description of the Buyable item.
*
* @return string
*/
Expand All @@ -31,4 +38,18 @@ public function getBuyablePrice($options = null);
* @return float
*/
public function getBuyableWeight($options = null);

/**
* Get the image url of the Buyable item.
*
* @return string
*/
public function getBuyableImageUrl($options = null);

/**
* Check if buyable has stock available for quantity requested
* @param int $qtyRequired
* @return bool
*/
public function isBuyableHasStock($qtyRequired = 1);
}

0 comments on commit 0206ce2

Please sign in to comment.