PHP code example of aiarmada / filament-cart

1. Go to this page and download the library: Download aiarmada/filament-cart library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aiarmada / filament-cart example snippets


use AIArmada\FilamentCart\FilamentCartPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentCartPlugin::make(),
        ]);
}

// config/filament-cart.php

return [
    'navigation' => [
        'group' => 'E-Commerce'
    ],
    'polling_interval' => 30,
    'enable_global_conditions' => true,
    'dynamic_rules_factory' => \AIArmada\Cart\Services\BuiltInRulesFactory::class,
    
    'synchronization' => [
        'queue_sync' => false,
        'queue_connection' => 'default',
        'queue_name' => 'cart-sync',
    ],
];

use AIArmada\Cart\Models\Condition;

Condition::create([
    'name' => 'bulk_discount',
    'display_name' => '10% Bulk Discount',
    'type' => 'discount',
    'target' => 'cart@cart_subtotal/aggregate',
    'value' => '-10%',
    'rules' => [
        'factory_keys' => ['min-items', 'total-at-least'],
        'context' => ['min' => 3, 'amount' => 10000],
    ],
    'is_active' => true,
    'is_global' => true,
]);
bash
php artisan vendor:publish --tag="filament-cart-config"