justbetter/laravel-magento-customer-prices
Laravel package for bringing Magento customer-specific pricing into your application. Retrieve and cache product prices for customer groups and individual customers via Magento, so authenticated users see accurate personalized prices in your Laravel storefront or admin tools.
composer require justbetter/laravel-magento-customer-prices
php artisan vendor:publish --tag="magento-customer-prices-config"
.env (names follow the published config): the Magento base URL, an integration/admin token, and the store/website code you want to target. Missing or wrong store code is the most common source of silent no-ops.The fastest sanity check is a one-off artisan call against a known test customer, tailing storage/logs/laravel.log and watching the Magento request response. Don't wire up the scheduler until a single customer round-trips correctly.
Custom source as the primary extension point. Bind your source in a service provider rather than editing the config's class string inline — it keeps environment overrides and test fakes clean:
$this->app->bind(CustomerPriceSource::class, DatabasePriceSource::class);
Shape the source so it can return a scoped set (one customer, or a chunk) — the package will call it per customer or per batch depending on config, and a source that always dumps the whole catalogue will be unusably slow.
Batch/scheduled sync. Drive the full sync from a scheduled command with a sensible withoutOverlapping() and a batch size matched to your Magento API rate limits. For catalogues with millions of price rows, chunk by customer or by SKU range so a single failure doesn't invalidate the whole run.
Event-driven updates. For price changes that happen at runtime (a quote is accepted, a contract is renegotiated), dispatch the package's sync job for just that customer. This keeps Magento near-real-time without re-pushing everything. Wrap it in your own domain event listener so the pricing logic stays out of controllers.
Queued syncing for volume. Configure the package to push each customer (or price chunk) as a queued job. Give it a dedicated queue with its own worker count so Magento latency doesn't starve your normal jobs, and set retry_after and tries explicitly — Magento will occasionally 5xx or rate-limit, and default retries are too shallow for external API work.
Testing. Bind an in-memory / array source in your test suite and assert that the sync job produced the expected payloads. Mock the HTTP client (via Http::fake() if the package uses Laravel's HTTP client) so tests never hit a real Magento instance. Assert on the price rows you sent, not just that the job ran — scope, currency, and rounding are the fields that break.
Idempotent re-sync. Design your source so calling it twice for the same customer produces identical output. Prices are state, not events; you should be able to re-run yesterday's sync safely.
number_format(..., 2, '.', '') (or your currency's precision) at the boundary, and keep the currency code alongside the price.php artisan config:clear after changes; stale cached config showing the old endpoint is a frequent false alarm.failed handler (custom alerting/Slack), and package events/dispatchers for post-sync hooks. Override these rather than copying package internals into your app — you'll lose the ability to pull upstream fixes (last release 2026-04-02).How can I help you explore Laravel packages today?