Download the PHP package setono/sylius-pickup-point-plugin without Composer
On this page you can find all versions of the php package setono/sylius-pickup-point-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download setono/sylius-pickup-point-plugin
More information about setono/sylius-pickup-point-plugin
Files in setono/sylius-pickup-point-plugin
Package sylius-pickup-point-plugin
Short Description Pickup point plugin for Sylius
License MIT
Informations about the package sylius-pickup-point-plugin
Sylius Pickup Point Plugin
Add a pickup-point chooser to your shipping checkout step.
- Screenshots
- Installation
Supported providers
- DAO
- GLS
- PostNord
- Fake provider (for development/playing purposes — not enabled in
prod) - ...or add your own
Compatibility
| Plugin | Sylius | PHP | Symfony |
|---|---|---|---|
| 2.x | ^2.0 |
>=8.2 |
^6.4 \|\| ^7.4 |
| 1.x | ^1.0 |
>=8.1 |
^5.4 \|\| ^6.0 |
Migrating from 1.x to 2.x: see UPGRADE.md.
Screenshots
Shop
This is the shipping method step in the checkout process where you can choose a pickup point. The points are loaded asynchronously after the page renders, the nearest one is pre-selected, and the shopper can expand the list to pick another.
Admin
On the order you can see what pickup point the customer has chosen.
When you edit shipping method you can associate a pickup point provider to that shipping method.
Installation
Step 1: Install and enable plugin
Add the bundle to your config/bundles.php:
Step 2: Import routing
If your store has localized URLs disabled,
import @SetonoSyliusPickupPointPlugin/config/routes_no_locale.yaml instead.
Step 3: Customize resources
Shipment resource
Shipping method resource
You can read about extending resources here.
Update shipping resources config
Step 4: Configure plugin
Enable desired providers
fakerwill not work in the production environment- Each carrier provider requires its corresponding bundle to be installed:
dao→setono/dao-bundlegls→setono/gls-webservice-bundlepost_nord→setono/post-nord-bundle
The carrier bundles are listed in this plugin's suggest section — install only the ones you need.
Step 5: Database
Step 6: Validation groups
Add checkout_select_shipping to sylius.form.type.checkout_select_shipping.validation_groups:
Step 7: Install assets
The plugin's JavaScript and CSS are auto-included on the shop checkout via Twig
hooks (sylius_shop.checkout#javascripts / sylius_shop.checkout#stylesheets).
The chooser is a framework-free ES module (loaded with <script type="module">)
that builds its UI by cloning overridable Twig <template>s, so you can restyle or
extend it without forking — see
docs/customizing-the-chooser.md.
Step 8: Admin shipping method form
Add the pickupPointProvider field to your admin shipping-method form. With
Sylius 2.x's Twig hooks the cleanest path is a project-local hook config that
points at a template containing {{ form_row(form.pickupPointProvider) }},
attached to sylius_admin.shipping_method.update.content.form.options (or a
form section you already render).
Creating a custom provider
A provider returns the pickup points near an order's address and re-resolves a single point by its id. To add
your own carrier, implement Setono\SyliusPickupPointPlugin\Provider\ProviderInterface — or, more simply,
extend the abstract Setono\SyliusPickupPointPlugin\Provider\Provider, which already handles the registered
code (getCode()), so you only implement two methods.
Register it. With Symfony autoconfiguration on (the default), the #[AsProvider(code, name)] attribute is all
you need — the plugin turns it into the setono_sylius_pickup_point.provider tag and the compiler pass does the
rest. Without autoconfiguration, tag the service yourself:
The code is the machine identifier (registry key, the value stored on the shipping method, and the provider
part of the pickup-point token); name is the carrier's brand name shown to merchants in the admin form.
Use it. A custom provider is just a registered service — it does not go in the setono_sylius_pickup_point.providers
config (that toggle is only for the plugin's bundled optional providers). To put it to work, edit a shipping
method in the admin and set its Pickup point provider to yours (ACME); its points are then fetched live at
that method's checkout.
Good to know:
- Providers are called live and lazily — construction is deferred until the provider is first used, and the
/pickup-pointsendpoint wraps each provider in its owntry/catch, so a slow or throwing carrier degrades gracefully instead of blocking checkout. - The submitted token is the whole
PickupPoint, decoded straight back on submit —findPickupPoint()is only for re-resolving a point from a bare id/metadata. Put any extra context your API needs to do that intoPickupPoint::$metadata(it round-trips inside the identifier); the well-knowncountryis folded in for you. - Build an
Addressfrom an order withAddress::fromOrder($order)when calling a provider outside checkout.
Play
To see the pickup points list, use the following example address at checkout:
Providers have pickup points in the following countries:
- DAO: DK
- PostNord: DK, SE, FI
- GLS: See https://gls-group.eu/EU/en/depot-parcelshop-search
So, to play with all 3 providers at once — use a DK address.
All versions of sylius-pickup-point-plugin with dependencies
doctrine/dbal Version ^3.0 || ^4.0
doctrine/orm Version ^3.0
fakerphp/faker Version ^1.21
sylius/core Version ^2.0
sylius/core-bundle Version ^2.0
sylius/order Version ^2.0
sylius/shipping Version ^2.0
sylius/shipping-bundle Version ^2.0
symfony/config Version ^6.4 || ^7.4
symfony/dependency-injection Version ^6.4 || ^7.4
symfony/form Version ^6.4 || ^7.4
symfony/http-foundation Version ^6.4 || ^7.4
symfony/http-kernel Version ^6.4 || ^7.4
symfony/options-resolver Version ^6.4 || ^7.4
symfony/validator Version ^6.4 || ^7.4
webmozart/assert Version ^1.11