Open dgrigg opened 2 days ago
Products is just a standard Statamic collection so you can make a search index on it: https://statamic.dev/collections#search-indexes
Within this index define a transformer which should return all your skus... something like:
'transformers' => [
// Return a value to store in the index.
'variants' => function ($value, $searchable) {
return \Statamic\Facades\Entry::where('collection', 'variants')->whereIn('id', $searchable->get('variants'))->get()->map(fn ($variant) => $variant->sku));
},
]
Description
Is it possible to search for a product in Statamic using the product's SKU from Shopify? Right now it appears the search only works against the product title which is a little restrictive.
Steps to reproduce
Environment
Environment Application Name: Statamic Laravel Version: 10.48.22 PHP Version: 8.2.19 Composer Version: 2.7.6 Environment: local Debug Mode: ENABLED URL: localhost:3000 Maintenance Mode: OFF
Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED
Drivers Broadcasting: log Cache: file Database: mysql Logs: stack / single Mail: mailgun Queue: database Session: file
Statamic Addons: 4 Sites: 1 Stache Watcher: Disabled Static Caching: Disabled Version: 5.25.0 PRO
Statamic Addons aerni/advanced-seo: 2.9.0 pxlp/headless: dev-main statamic-rad-pack/shopify: 4.0.5 statamic/eloquent-driver: 4.16.0
Statamic Eloquent Driver Asset Containers: eloquent Assets: eloquent Blueprints: file Collection Trees: eloquent Collections: eloquent Entries: eloquent Forms: file Global Sets: file Global Variables: file Navigation Trees: file Navigations: file Revisions: file Sites: file Taxonomies: file Terms: file Tokens: file