### Install Cart Package (~2.0) - Composer - Shell Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Installs version ~2.0 of the `darryldecode/cart` package using Composer. This version is typically used for older Laravel applications (v5.1 and below). It requires Composer to be installed globally or locally. ```Shell composer require "darryldecode/cart:~2.0" ``` -------------------------------- ### Getting Cart Subtotal and Total with Conditions PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Illustrates how to fetch the calculated cart subtotal and total. `getSubTotal()` includes item conditions and cart conditions targeting 'subtotal', while `getTotal()` includes conditions targeting 'total'. Examples for both the default cart and user sessions are shown. ```php $cartTotal = Cart::getSubTotal(); // the subtotal with the conditions targeted to "subtotal" applied $cartTotal = Cart::getTotal(); // the total with the conditions targeted to "total" applied $cartTotal = Cart::session($userId)->getSubTotal(); // for a specific user's cart $cartTotal = Cart::session($userId)->getTotal(); // for a specific user's cart ``` -------------------------------- ### Install Cart Package (~4.0+) - Composer - Shell Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Installs version ~4.0 or the latest version of the `darryldecode/cart` package using Composer. This version is compatible with newer Laravel versions (v5.5, 5.6, 5.7~, 9). It requires Composer to be installed globally or locally. ```Shell composer require "darryldecode/cart:~4.0" ``` ```Shell composer require "darryldecode/cart" ``` -------------------------------- ### Registering Multiple Cart Instances - Laravel Shopping Cart - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Provides examples of registering multiple, independent instances of the cart service provider within a Laravel application. This is achieved by binding different instances to the service container with unique names (e.g., 'wishlist'), allowing separate cart data management. It shows examples for older (share) and newer (singleton) Laravel versions. ```PHP $this->app['wishlist'] = $this->app->share(function($app) { $storage = $app['session']; // laravel session storage $events = $app['events']; // laravel event handler $instanceName = 'wishlist'; // your cart instance name $session_key = 'AsASDMCks0ks1'; // your unique session key to hold cart items return new Cart( $storage, $events, $instanceName, $session_key ); }); // for 5.4 or newer use Darryldecode\Cart\Cart; use Illuminate\Support\ServiceProvider; class WishListProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return void */ public function boot() { // } /** * Register the application services. * * @return void */ public function register() { $this->app->singleton('wishlist', function($app) { $storage = $app['session']; $events = $app['events']; $instanceName = 'cart_2'; $session_key = '88uuiioo99888'; return new Cart( $storage, $events, $instanceName, $session_key, config('shopping_cart') ); }); } } ``` -------------------------------- ### Adding Multiple Cart Conditions Separately PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Shows how to create multiple distinct cart-based condition instances and add them one by one to the global cart. Includes examples with different targets, types, values, and explicit 'order' properties. ```php // or add multiple conditions from different condition instances $condition1 = new \Darryldecode\Cart\CartCondition(array( 'name' => 'VAT 12.5%', 'type' => 'tax', 'target' => 'subtotal', // this condition will be applied to cart's subtotal when getSubTotal() is called. 'value' => '12.5%', 'order' => 2 )); $condition2 = new \Darryldecode\Cart\CartCondition(array( 'name' => 'Express Shipping $15', 'type' => 'shipping', 'target' => 'subtotal', // this condition will be applied to cart's subtotal when getSubTotal() is called. 'value' => '+15', 'order' => 1 )); Cart::condition($condition1); Cart::condition($condition2); // Note that after adding conditions that are targeted to be applied on subtotal, the result on getTotal() // will also be affected as getTotal() depends in getSubTotal() which is the subtotal. ``` -------------------------------- ### Implementing Database Storage Class for Cart in PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md This custom storage class, `DBStorage`, implements the necessary methods (`has`, `get`, `put`) to store cart data in the database using the `DatabaseStorageModel`. `has` checks for an existing record, `get` retrieves data and wraps it in a `CartCollection`, and `put` either creates a new record or updates an existing one. ```PHP class DBStorage { public function has($key) { return DatabaseStorageModel::find($key); } public function get($key) { if($this->has($key)) { return new CartCollection(DatabaseStorageModel::find($key)->cart_data); } else { return []; } } public function put($key, $value) { if($row = DatabaseStorageModel::find($key)) { // update $row->cart_data = $value; $row->save(); } else { DatabaseStorageModel::create([ 'id' => $key, 'cart_data' => $value ]); } } } ``` -------------------------------- ### Getting All Cart Conditions and Properties PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Retrieves all conditions that have been applied to the entire cart (cart-based conditions) and demonstrates how to iterate through the collection and access properties of each condition instance. ```php // To get all applied conditions on a cart, use below: $cartConditions = Cart::getConditions(); foreach($cartConditions as $condition) { $condition->getTarget(); // the target of which the condition was applied $condition->getName(); // the name of the condition $condition->getType(); // the type $condition->getValue(); // the value of the condition $condition->getOrder(); // the order of the condition $condition->getAttributes(); // the attributes of the condition, returns an empty [] if no attributes added } ``` -------------------------------- ### Register Cart Service Provider - Laravel Config - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Adds the `Darryldecode\Cart\CartServiceProvider::class` to the `providers` array within the Laravel `config/app.php` file. This action registers the package's service provider with the Laravel framework, making its components available. It's a manual configuration step required after installation. ```PHP Darryldecode\Cart\CartServiceProvider::class ``` -------------------------------- ### Adding Items and Accessing Item Properties - Laravel Shopping Cart - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Provides examples of adding multiple items to the cart using the array format and subsequently retrieving and iterating through the cart's content. It demonstrates how to access common item properties like id, name, price, quantity, and attributes, including checking for specific attributes. ```PHP // add items to cart Cart::add(array( array( 'id' => 456, 'name' => 'Sample Item 1', 'price' => 67.99, 'quantity' => 4, 'attributes' => array() ), array( 'id' => 568, 'name' => 'Sample Item 2', 'price' => 69.25, 'quantity' => 4, 'attributes' => array( 'size' => 'L', 'color' => 'blue' ) ), )); // then you can: $items = Cart::getContent(); foreach($items as $item) { $item->id; // the Id of the item $item->name; // the name $item->price; // the single price without conditions applied $item->getPriceSum(); // the subtotal without conditions applied $item->getPriceWithConditions(); // the single price with conditions applied $item->getPriceSumWithConditions(); // the subtotal with conditions applied $item->quantity; // the quantity $item->attributes; // the attributes // Note that attribute returns ItemAttributeCollection object that extends the native laravel collection // so you can do things like below: if( $item->attributes->has('size') ) { // item has attribute size } else { // item has no attribute size } } // or $items->each(function($item) { $item->id; // the Id of the item $item->name; // the name $item->price; // the single price without conditions applied $item->getPriceSum(); // the subtotal without conditions applied $item->getPriceWithConditions(); // the single price with conditions applied $item->getPriceSumWithConditions(); // the subtotal with conditions applied $item->quantity; // the quantity $item->attributes; // the attributes if( $item->attributes->has('size') ) { // item has attribute size } else { // item has no attribute size } }); ``` -------------------------------- ### Register Cart Facade Alias - Laravel Config - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Creates a 'Cart' alias for the `Darryldecode\Cart\Facades\CartFacade::class` within the `aliases` array in Laravel's `config/app.php`. This allows developers to use the convenient `\Cart::` syntax to access cart methods throughout the application without the full namespace. It's a manual configuration step required after installation. ```PHP 'Cart' => Darryldecode\Cart\Facades\CartFacade::class ``` -------------------------------- ### Getting Specific Cart Condition by Name PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Shows how to retrieve a single cart-based condition by its unique name and access its properties. Returns null if a condition with the specified name is not found. ```php // You can also get a condition that has been applied on the cart by using its name, use below: $condition = Cart::getCondition('VAT 12.5%'); $condition->getTarget(); // the target of which the condition was applied $condition->getName(); // the name of the condition $condition->getType(); // the type $condition->getValue(); // the value of the condition $condition->getAttributes(); // the attributes of the condition, returns an empty [] if no attributes added ``` -------------------------------- ### Getting Cart Conditions by Type Method Signature PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Shows the method signature for `Cart::getConditionsByType($type)`. This method retrieves only cart-based conditions (not item conditions) that match the specified type. ```php /** * Get all the condition filtered by Type * Please Note that this will only return condition added on cart bases, not those conditions added * specifically on an per item bases * * @param $type * @return CartConditionCollection */ public function getConditionsByType($type) ``` -------------------------------- ### Getting Calculated Value of a Cart Condition PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Demonstrates how to retrieve a specific cart condition and calculate its value impact based on the current cart subtotal using the `getCalculatedValue()` method. ```php // You can get the conditions calculated value by providing the subtotal, see below: $subTotal = Cart::getSubTotal(); $condition = Cart::getCondition('VAT 12.5%'); $conditionCalculatedValue = $condition->getCalculatedValue($subTotal); ``` -------------------------------- ### Implementing Cache/Cookie Storage Class for Cart in PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md This custom storage class, `CacheStorage`, uses Laravel's Cache component for storing cart data and a cookie for persisting the cart ID across sessions. It implements the required `has`, `get`, and `put` methods, storing data in cache for 30 days and setting a cookie with the cart ID. ```PHP namespace App\Cart; use Carbon\Carbon; use Cookie; use Darryldecode\Cart\CartCollection; class CacheStorage { private $data = []; private $cart_id; public function __construct() { $this->cart_id = \Cookie::get('cart'); if ($this->cart_id) { $this->data = \Cache::get('cart_' . $this->cart_id, []); } else { $this->cart_id = uniqid(); } } public function has($key) { return isset($this->data[$key]); } public function get($key) { return new CartCollection($this->data[$key] ?? []); } public function put($key, $value) { $this->data[$key] = $value; \Cache::put('cart_' . $this->cart_id, $this->data, Carbon::now()->addDays(30)); if (!Cookie::hasQueued('cart')) { Cookie::queue( Cookie::make('cart', $this->cart_id, 60 * 24 * 30) ); } } } ``` -------------------------------- ### Publish Cart Configuration - Artisan Command - Shell Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Executes the Artisan command `vendor:publish` to copy the default configuration file for the `Darryldecode\Cart\CartServiceProvider` tagged as 'config' into the application's `config` directory. This allows customization of package settings like storage driver or session key. Requires running the command in the project root via the command line. ```Shell php artisan vendor:publish --provider="Darryldecode\Cart\CartServiceProvider" --tag="config" ``` -------------------------------- ### Quick Cart Operations with Session & Model - Laravel - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Provides a quick demonstration of fundamental cart operations: adding, updating, removing, and iterating through items using the `\Cart` facade. It shows how to bind the cart content to a specific user session ID and associate a Laravel Eloquent `Product` model with cart items for easy data retrieval. Requires the package configured and a `Product` model. ```PHP // Quick Usage with the Product Model Association & User session binding $Product = Product::find($productId); // assuming you have a Product model with id, name, description & price $rowId = 456; // generate a unique() row ID $userID = 2; // the user ID to bind the cart contents // add the product to cart \Cart::session($userID)->add(array( 'id' => $rowId, 'name' => $Product->name, 'price' => $Product->price, 'quantity' => 4, 'attributes' => array(), 'associatedModel' => $Product )); // update the item on cart \Cart::session($userID)->update($rowId,[ 'quantity' => 2, 'price' => 98.67 ]); // delete an item on cart \Cart::session($userID)->remove($rowId); // view the cart items $items = \Cart::getContent(); foreach($items as $row) { echo $row->id; // row ID echo $row->name; echo $row->qty; echo $row->price; echo $item->associatedModel->id; // whatever properties your model have echo $item->associatedModel->name; // whatever properties your model have echo $item->associatedModel->description; // whatever properties your model have } // FOR FULL USAGE, SEE BELOW.. ``` -------------------------------- ### Adding Item with Multiple Conditions PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Demonstrates how to apply multiple conditions directly to an item by including an array of condition instances in the item's data when it is added to the cart. ```php // you may also add multiple condition on an item $itemCondition1 = new \Darryldecode\Cart\CartCondition(array( 'name' => 'SALE 5%', 'type' => 'sale', 'value' => '-5%', )); $itemCondition2 = new CartCondition(array( 'name' => 'Item Gift Pack 25.00', 'type' => 'promo', 'value' => '-25', )); $itemCondition3 = new \Darryldecode\Cart\CartCondition(array( 'name' => 'MISC', 'type' => 'misc', 'value' => '+10', )); $item = array( 'id' => 456, 'name' => 'Sample Item 1', 'price' => 100, 'quantity' => 1, 'attributes' => array(), 'conditions' => [$itemCondition1, $itemCondition2, $itemCondition3] ); Cart::add($item); ``` -------------------------------- ### Registering Custom Cart Instance with Database Storage in PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md This code demonstrates how to register a custom cart instance (e.g., a 'wishlist') within a Laravel Service Provider. It binds a singleton 'wishlist' to the service container, instantiates the custom `DBStorage` class, and configures a new `Cart` instance with this specific storage driver, a unique instance name, and session key. ```PHP use Darryldecode\Cart\Cart; use Illuminate\Support\ServiceProvider; class WishListProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return void */ public function boot() { // } /** * Register the application services. * * @return void */ public function register() { $this->app->singleton('wishlist', function($app) { $storage = new DBStorage(); <-- Your new custom storage $events = $app['events']; $instanceName = 'cart_2'; $session_key = '88uuiioo99888'; return new Cart( $storage, $events, $instanceName, $session_key, config('shopping_cart') ); }); } } ``` -------------------------------- ### Creating Cart Database Storage Table Migration in PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md This migration file defines the schema for a database table named 'cart_storage' to persist cart data. It includes an indexed string 'id', a 'longText' field for serialized cart data, and timestamps. The 'down' method drops the table. ```PHP use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCartStorageTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('cart_storage', function (Blueprint $table) { $table->string('id')->index(); $table->longText('cart_data'); $table->timestamps(); $table->primary('id'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('cart_storage'); } } ``` -------------------------------- ### Adding Item with Single Condition PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Shows how to apply a single condition directly to an item when it is added to the cart. The 'target' parameter is not needed for item conditions. ```php // lets create first our condition instance $saleCondition = new \Darryldecode\Cart\CartCondition(array( 'name' => 'SALE 5%', 'type' => 'tax', 'value' => '-5%', )); // now the product to be added on cart $product = array( 'id' => 456, 'name' => 'Sample Item 1', 'price' => 100, 'quantity' => 1, 'attributes' => array(), 'conditions' => $saleCondition ); // finally add the product on the cart Cart::add($product); ``` -------------------------------- ### Adding Multiple Cart Conditions Array PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Shows an alternative method for adding multiple cart-based conditions by passing an array of condition instances to the `Cart::condition()` method. ```php // or add multiple conditions as array Cart::condition([$condition1, $condition2]); ``` -------------------------------- ### Adding Condition to Existing Item PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Shows how to add a new condition to an item that is already present in the cart using its product ID and a new condition instance. Useful for applying dynamic conditions like coupons post-item-addition. ```php //$productID = 456; $coupon101 = new CartCondition(array( 'name' => 'COUPON 101', 'type' => 'coupon', 'value' => '-5%', )); Cart::addItemCondition($productID, $coupon101); ``` -------------------------------- ### Retrieving Single Item Price With Conditions - Laravel Shopping Cart - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Documents the getPriceWithConditions method signature. This method calculates and returns the price of a single item after applying only the conditions specifically assigned to that item. It does not consider global cart conditions. ```PHP /** * get the single price in which conditions are already applied * * @return mixed|null */ public function getPriceWithConditions() ``` -------------------------------- ### Calculating Subtotal with Item and Cart Conditions PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Explains that calling `Cart::getSubTotal()` calculates the cart subtotal after applying both per-item conditions and cart-based conditions that have 'subtotal' as their target. ```php // the subtotal will be calculated based on the conditions added that has target => "subtotal" // and also conditions that are added on per item $cartSubTotal = Cart::getSubTotal(); ``` -------------------------------- ### Adding Cart Condition Targeting Total PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Demonstrates adding a cart-based condition specifically targeting the 'total' value of the cart. This type of condition is applied after the subtotal calculation. ```php // add condition to only apply on totals, not in subtotal $condition = new \Darryldecode\Cart\CartCondition(array( 'name' => 'Express Shipping $15', 'type' => 'shipping', 'target' => 'total', // this condition will be applied to cart's total when getTotal() is called. 'value' => '+15', 'order' => 1 // the order of calculation of cart base conditions. The bigger the later to be applied. )); Cart::condition($condition); // The property 'order' lets you control the sequence of conditions when calculated. Also it lets you add different conditions through for example a shopping process with multiple // pages and still be able to set an order to apply the conditions. If no order is defined defaults to 0 // NOTE!! On current version, 'order' parameter is only applicable for conditions for cart bases. It does not support on per item conditions. ``` -------------------------------- ### Defining Cart Database Storage Eloquent Model in PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md This Eloquent model, `DatabaseStorageModel`, is designed to interact with the `cart_storage` database table. It specifies the table name, defines mass assignable attributes ('id', 'cart_data'), and uses attribute accessors (`setCartDataAttribute`, `getCartDataAttribute`) to automatically serialize data before saving and unserialize it after retrieving. ```PHP namespace App; use Illuminate\Database\Eloquent\Model; class DatabaseStorageModel extends Model { protected $table = 'cart_storage'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'id', 'cart_data', ]; public function setCartDataAttribute($value) { $this->attributes['cart_data'] = serialize($value); } public function getCartDataAttribute($value) { return unserialize($value); } } ``` -------------------------------- ### Retrieving Item Subtotal With Conditions - Laravel Shopping Cart - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Documents the getPriceSumWithConditions method signature. This method calculates and returns the subtotal (price * quantity) for an item after applying only the conditions specifically assigned to that item. It does not consider global cart conditions. ```PHP /** * get the sum of price in which conditions are already applied * * @return mixed|null */ public function getPriceSumWithConditions() ``` -------------------------------- ### Adding Single Cart Condition PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Demonstrates creating and adding a single cart-based condition to the default cart or a specific user's cart. The condition targets the 'subtotal' and adds a 12.5% VAT. ```php // add single condition on a cart bases $condition = new \Darryldecode\Cart\CartCondition(array( 'name' => 'VAT 12.5%', 'type' => 'tax', 'target' => 'subtotal', // this condition will be applied to cart's subtotal when getSubTotal() is called. 'value' => '12.5%', 'attributes' => array( // attributes field is optional 'description' => 'Value added tax', 'more_data' => 'more data here' ) )); Cart::condition($condition); Cart::session($userId)->condition($condition); // for a speicifc user's cart ``` -------------------------------- ### Associating Eloquent Models with Cart Items - Laravel Shopping Cart - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Demonstrates various methods for associating a Laravel Eloquent model with a cart item. This allows access to model properties directly from the cart item object (e.g., $row->model->name) after retrieval. The association is typically done during the item addition process. ```PHP // add the item to the cart. $cartItem = Cart::add(455, 'Sample Item', 100.99, 2, array())->associate('Product'); // array format Cart::add(array( 'id' => 456, 'name' => 'Sample Item', 'price' => 67.99, 'quantity' => 4, 'attributes' => array(), 'associatedModel' => 'Product' )); // add multiple items at one time Cart::add(array( array( 'id' => 456, 'name' => 'Sample Item 1', 'price' => 67.99, 'quantity' => 4, 'attributes' => array(), 'associatedModel' => 'Product' ), array( 'id' => 568, 'name' => 'Sample Item 2', 'price' => 69.25, 'quantity' => 4, 'attributes' => array( 'size' => 'L', 'color' => 'blue' ), 'associatedModel' => 'Product' ), )); // Now, when iterating over the content of the cart, you can access the model. foreach(Cart::getContent() as $row) { echo 'You have ' . $row->qty . ' items of ' . $row->model->name . ' with description: "' . $row->model->description . '" in your cart.'; } ``` -------------------------------- ### Clearing All Conditions for an Item PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Provides the method signature and description for `Cart::clearItemConditions($itemId)`, used to remove all conditions that have been applied to a specific item already in the cart. ```php /** * remove all conditions that has been applied on an item that is already on the cart * * @param $itemId * @return bool */ Cart::clearItemConditions($itemId) ``` -------------------------------- ### Clearing All Cart Conditions PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Provides the method signature and description for `Cart::clearCartConditions()`, which removes all conditions that were added directly to the whole cart, but leaves item-specific conditions intact. ```php /** * clears all conditions on a cart, * this does not remove conditions that has been added specifically to an item/product. * If you wish to remove a specific condition to a product, you may use the method: removeItemCondition($itemId,$conditionName) * * @return void */ Cart::clearCartConditions() ``` -------------------------------- ### Retrieving Item Subtotal Without Conditions - Laravel Shopping Cart - PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Documents the getPriceSum method signature. This method is used to calculate and return the sum of an item's price multiplied by its quantity, excluding any cart or item conditions. It returns the raw subtotal for the item. ```PHP /** * get the sum of price * * @return mixed|null */ public function getPriceSum() ``` -------------------------------- ### Removing Specific Item Condition by Name PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Provides the method signature and description for `Cart::removeItemCondition($itemId, $conditionName)`, used to remove a specific condition from an item already in the cart by specifying the item's ID and the condition's name. ```php /** * remove a condition that has been applied on an item that is already on the cart * * @param $itemId * @param $conditionName * @return bool */ Cart::removeItemCondition($itemId, $conditionName) ``` -------------------------------- ### Removing Cart Conditions by Type Method Signature PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Shows the method signature for `Cart::removeConditionsByType($type)`. This method removes all cart-based conditions (not item conditions) that match the specified type. ```php /** * Remove all the condition with the $type specified * Please Note that this will only remove condition added on cart bases, not those conditions added * specifically on an per item bases * * @param $type * @return $this */ public function removeConditionsByType($type) ``` -------------------------------- ### Removing Specific Cart Condition by Name PHP Source: https://github.com/darryldecode/laravelshoppingcart/blob/master/README.md Provides the method signature and description for `Cart::removeCartCondition($conditionName)`, used to remove a specific condition applied to the entire cart by providing its name. Does not affect item-specific conditions. ```php /** * removes a condition on a cart by condition name, * this can only remove conditions that are added on cart bases not conditions that are added on an item/product. * If you wish to remove a condition that has been added for a specific item/product, you may * use the removeItemCondition(itemId, conditionName) method instead. * * @param $conditionName * @return void */ $conditionName = 'Summer Sale 5%'; Cart::removeCartCondition($conditionName) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.