Contracts
1 year ago
BaseCart.php
1 year ago
CartFactory.php
1 year ago
EddCart.php
1 year ago
NativeCart.php
10 months ago
WooCart.php
10 months ago
BaseCart.php
52 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Base cart for handling common functionalities |
| 4 | * |
| 5 | * @package Tutor\Ecommerce |
| 6 | * @author Themeum |
| 7 | * @link https://themeum.com |
| 8 | * @since 3.5.0 |
| 9 | */ |
| 10 | |
| 11 | namespace Tutor\Ecommerce\Cart; |
| 12 | |
| 13 | /** |
| 14 | * BaseCart class |
| 15 | */ |
| 16 | class BaseCart { |
| 17 | |
| 18 | /** |
| 19 | * Cart error |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | protected $cart_error; |
| 24 | |
| 25 | /** |
| 26 | * Current user id |
| 27 | * |
| 28 | * @var int |
| 29 | */ |
| 30 | protected $user_id; |
| 31 | |
| 32 | /** |
| 33 | * Initialize member variables |
| 34 | * |
| 35 | * @return void |
| 36 | */ |
| 37 | public function __construct() { |
| 38 | $this->cart_error = __( 'Failed to add item to the cart', 'tutor' ); |
| 39 | $this->user_id = get_current_user_id(); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Get cart error |
| 44 | * |
| 45 | * @return string |
| 46 | */ |
| 47 | public function get_error(): string { |
| 48 | return $this->cart_error; |
| 49 | } |
| 50 | |
| 51 | } |
| 52 |