Home

Awesome

Scrutinizer Code Quality Code Coverage Build Status

Magento Module LarsRoettig_GraphQLStorePickup

Main Functionalities

I will show how you can build your GraphQL for Magento 2.3 and extend them with a filter logic. Our use case is a Pickup from Store endpoint what our frontend team needs to create an interactive map.


We are hire ! Wanna work for one of Germany’s leading Magento partners? With agile methods, small teams and big clients? We’re currently looking for experienced PHP & Magento developers in Munich/Rosenheim. Sounds interesting? Just drop me a line via l.roettig+github@techdivision.com


In the story, we have the following acceptance criteria.

As a frontend developer, I need Endpoint to search for the next Pickup Store in a Postcode Area. Use a setup script initial import Allow search for Postcode or Name. API will return the following attributes for a Pickup Store

<table class="table-auto w-full"> <thead> <tr class="border bg-gray-100"> <th class="px-4 py-2">Arrribute Name</th> <th class="px-4 py-2">GraphQL field</th> </tr> </thead> <tbody> <tr> <td class="border px-4 py-2">Name</td> <td class="border px-4 py-2">name</td> </tr> <tr> <td class="border px-4 py-2">Postcode</td> <td class="border px-4 py-2">postcode</td> </tr> <tr> <td class="border px-4 py-2">Street</td> <td class="border px-4 py-2">street</td> </tr> <tr> <td class="border px-4 py-2">Street Number</td> <td class="border px-4 py-2">street_num</td> </tr> <tr> <td class="border px-4 py-2">City</td> <td class="border px-4 py-2">city</td> </tr> <tr> <td class="border px-4 py-2">Longitude</td> <td class="border px-4 py-2">longitude</td> </tr> <tr> <td class="border px-4 py-2">Latitude</td> <td class="border px-4 py-2">latitude</td> </tr> </tbody> </table>
:exclamation: The Code is not for a production server it is only proof of concept imeplementation :exclamation:

Features

Tested on Version

Installation

* = in production please use the --keep-generated option

Type 1: Zip file

Type 2: Composer

How to use it

Possibly Query (https://your_domain.test/graphql)

GraphQL_Playground

Simple Query without an filter:

{
  pickUpStores {
    total_count
      items {
        name
        street
        street_num
        postcode
      }
  }
}

Query with an filter:

{
  pickUpStores(
    filter: { name: { like: "Brick and Mortar 1%" } }
    pageSize: 2
    currentPage: 1
  ) {
    total_count
    items {
      name
      street
      postcode
    }
  }
}