PHP code example of kreatif / validus-shopify-bridge

1. Go to this page and download the library: Download kreatif/validus-shopify-bridge 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/ */

    

kreatif / validus-shopify-bridge example snippets


'payment_code_map' => [
    'shopify_payments' => 'CC',
],

'order_export' => [
    'webhook_log_disk' => env('VALIDUS_ORDER_EXPORT_WEBHOOK_LOG_DISK', 'local'),
    'webhook_log_directory' => env('VALIDUS_ORDER_EXPORT_WEBHOOK_LOG_DIRECTORY', 'validus-order-webhooks'),

    'request_log_disk' => env('VALIDUS_ORDER_EXPORT_REQUEST_LOG_DISK', 'local'),
    'request_log_directory' => env('VALIDUS_ORDER_EXPORT_REQUEST_LOG_DIRECTORY', 'validus-order-requests'),
],

Schedule::command('validus-shopify:sync-products')->hourly();

'deactivation' => [
    'enabled' => env('VALIDUS_SHOPIFY_AUTO_DEACTIVATE', true),
    'max_removed_ratio' => (float) env('VALIDUS_SHOPIFY_MAX_REMOVED_RATIO', 0.5),
],

$grouping = app(\Kreatif\ValidusShopifyBridge\Grouping\VariantGroupingStrategy::class);
$byKey = collect(app(\Kreatif\ValidusShopifyBridge\Clients\ValidusClient::class)->getProducts())
    ->groupBy(fn ($p) => $grouping->groupKey($p));

foreach ($byKey as $key => $group) {
    foreach ($group->groupBy(fn ($p) => $grouping->vintageYear($p).'/'.($p['code']['bottleCapacity'] ?? '?')) as $combo => $items) {
        if ($items->count() > 1) {
            echo "{$key} {$items->first()['name']} - {$combo}: ".$items->pluck('code.code')->implode(', ').PHP_EOL;
        }
    }
}