This extension provides a collection of helper functions to integrate with the shopware-pwa client library.
The current version of Shopware PWA requires an API version of 6.3.x or higher. Backwards compatible versions of this plugin are available. There's no version of this plugin for Shopware 6.1 anymore.
There is a video on how to set up the plugin correctly (please be aware that this applies to the old 6.1 version).
There are two ways you can require the plugin.
Run
$ composer require shopware-pwa/shopware-pwa
within your Shopware installation directory. This will install a composer managed package of the plugin. To use the latest version run
$ composer require shopware-pwa/shopware-pwa:dev-master
instead.
We recommend using this way of installing the plugin, because it reduces the risk of having an outdated/incompatible dependency.
Clone the repository into the local plugins directory of your Shopware installation.
$ git clone https://github.com/elkmod/SwagShopwarePwa.git custom/plugins/SwagShopwarePwa
This will allow you to make changes and pull requests to this very repository, since you're using a local copy of the plugin.
Run the following commands in your Shopware root directory.
Refresh plugin list
$ bin/console plugin:refresh
Install and activate the plugin
$ bin/console plugin:install --activate SwagShopwarePwa
Clear the cache (sometimes invalidation is needed for the new routes to activate)
$ bin/console cache:clear
Make sure you've created a sales channel and assigned SEO URL templates (either using the database or the administration panel).
Currently there are the following requirements: As headless sales channels don't support SEO URLs, you have to select a "storefront" sales channel as a base.
Refresh the index tables (containing the SEO URLs) manually
$ bin/console dal:refresh:index
This plugin adds multiple endpoints to both, the store and the admin API. All endpoints below accept POST
requests.
/store-api/v1/pwa/page
Resolves a given path to cms or product page and accepts include parameters to specifiy the fields contained in your response.
/store-api/v1/pwa/navigation
Delivers a category along with its child categories down to a desired level.
/api/v1/_action/pwa/dump-bundles
This endpoint is required to connect Shopware plugins with your PWA during the application build. It dumps your bundles metadata and PWA specific source files and delivers via a safe channel.
Tests are located in src/Test
and configured in phpunit.xml
.
In order to run the tests you have to set up the test database so that Shopware runs them with our plugin enabled.
After the plugin is installed in your shop, make sure you execute the follwing command (in the Shopware root directory) to dump the current configuration of your shop to the test-database (when using Docker, run it inside the container):
$ ./psh.phar init-test-databases
Then execute the following commands in the plugin's root directory to run the test.
$ composer install
$ ../../../vendor/bin/phpunit