PHP code example of goldnead / statamic-offers

1. Go to this page and download the library: Download goldnead/statamic-offers 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/ */

    

goldnead / statamic-offers example snippets


Catalogue::extend(fn (string $handle) => /* … */);

app(Checkout::class)->start('offer:fruehling-upsell', $buyer);

$eintrag = app(Catalogue::class)->find('offer:fruehlings-buendel');

$eintrag['product'];  // 'noten-paket', the lead
$eintrag['products']; // ['noten-paket', 'playback-paket', 'mitschnitt']

$basket = Basket::make($offer, $request->input('bumps', []), $request->input('coupon'));

['days' => 14, 'text' => '…', 'waiver_text' => '…', 'checkbox_

$basket = Basket::make($offer, amountCent: (int) $request->input('amount_cent'));
// throws AmountNotAccepted (an InvalidArgumentException with buyerMessage()) outside the bounds;
// without an amount, the suggestion is used

Schedule::command('offers:seats-reconcile')->hourly();
bash
php artisan offers:coupons:generate --count=50 --prefix=CHOR- --percent=15 --until=2027-03-31
bash
php artisan offers:install-boxes   # collection and blueprint, once