PHP code example of madbox-99 / filament-woocommerce

1. Go to this page and download the library: Download madbox-99/filament-woocommerce 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/ */

    

madbox-99 / filament-woocommerce example snippets


// app/Providers/Filament/AdminPanelProvider.php
use Madbox99\FilamentWooCommerce\FilamentWooCommercePlugin;

$panel->plugins([
    FilamentWooCommercePlugin::make(),
]);

'mappings' => [
    'products' => [
        'enabled' => true,
        'model' => \App\Models\Product::class,
        'syncer' => \Madbox99\FilamentWooCommerce\Sync\ProductSyncer::class,
        'field_map' => [
            'name' => 'name',
            'sku' => 'sku',
            'regular_price' => 'unit_price',
            // ...
        ],
    ],
    // product_categories, customers, orders …
],

use Madbox99\FilamentWooCommerce\Concerns\HasWooMapping;

final class Product extends Model
{
    use HasWooMapping;
}

// config/filament-woocommerce.php
'tenant' => [
    'column' => 'team_id',              // null disables the feature (default)
    'model' => \App\Models\Team::class, // optional — renders a Select in the store form
    'label_column' => 'name',
    'bypass_global_scopes' => true,
],

$product = Product::find(42);
$externalId = $product->wooExternalId(storeId: 1);
$mapping = $product->wooMappingFor(storeId: 1);
bash
composer vendor:publish --tag=filament-woocommerce-config
php artisan vendor:publish --tag=filament-woocommerce-migrations
php artisan migrate
bash
php artisan woo:sync                         # queue all active stores
php artisan woo:sync --store=1               # queue a single store
php artisan woo:sync --store=1 --entity=products
php artisan woo:sync --store=1 --sync        # run inline (no queue)