1. Go to this page and download the library: Download misaf/vendra-product 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/ */
misaf / vendra-product example snippets
use Misaf\VendraProduct\Models\ProductCategory;
$category = ProductCategory::query()->create([
'name' => ['en' => 'Beverages'],
'description' => ['en' => 'Cold and hot drinks'],
'slug' => ['en' => 'beverages'],
'active' => true,
]);
use Misaf\VendraProduct\Data\ProductPurchaseQuote;
use Misaf\VendraProduct\Data\ProductPurchaseRequest;
use Misaf\VendraProduct\Services\ProductPurchaseQuoter;
$quotes = app(ProductPurchaseQuoter::class)->quote([
'line-1' => new ProductPurchaseRequest(productId: $product->id, quantity: 2),
], 'USD');
$quote = $quotes['line-1']; // ProductPurchaseQuote, or a ProductPurchaseRefusalEnum case
use Misaf\VendraTagger\Models\Tagger;
$tag = Tagger::findOrCreate('Featured', type: 'product', locale: 'en');
$product->tags()->sync([$tag->getKey()]);