12 May 2022 by Karol Kielecki

April Releases: customizable webhook payloads, custom prices in checkout, full-text search for products

April was an eventful month for the Saleor team. First, we released Saleor 3.2, introducing customizable webhook payloads, and soon after, 3.3 with full-text search for products, and more. Let’s dive deep into what’s new!

Saleor is a headless commerce platform powered by Python, GraphQL, and React. If you don’t want to maintain the platform by yourself, you can run your e-commerce projects on Saleor Cloud. And now, we’re thrilled to announce that you can self-register to the cloud to test it for free!

However, as Saleor is also an open-source project, you can deploy it anywhere you want. There is no pressure around the choice of cloud versus self-hosted. We’re developer-first either way.

With v3.1, we introduced “Feature Preview” in order to gather feedback from our clients and the community. Those features may change with future releases. If you have any suggestions, please use GitHub Discussions or open an issue.


Saleor 3.2

Custom prices in checkout

It allows defining checkout items' custom prices. The variant price of the item in checkout can be overridden with any value. The overridden price is the base price, and if the voucher or sale is applied on checkout, the price will be reduced. It introduces the HANDLE_CHECKOUTS permission. The new permission is granted to all apps and groups with the MANAGE_CHECKOUT permission.

The following example shows how to set a custom price with the use of checkoutLinesAdd mutation:

mutation {
  checkoutLinesAdd(
    token: "d6d68835-6776-4caf-8db7-72e18d04d9a4"
    lines: [{
      quantity: 1,
      variantId: "UHJvZHVjdFZhcmlhbnQ6MzA2",
      price: 16.22
    }]
  ){
    checkout{
      token
      lines{
        variant{
          id
        }
        quantity
        totalPrice{
          gross{
            amount
            currency
          }
          net{
            amount
            currency
          }
        }
      }
    }
    errors{
      field
      message
    }
  }
}

You can learn more in our documentation.

Customizable webhook payloads

We decided to use GraphQL because it allows our users to control how much information their clients receive in response to every query.

Webhook payload subscriptions allow you to define webhook payload using graphQL subscription. Payloads are created dynamically. The first phase of this feature has been merged. At this moment, only async webhooks have been updated.

The example below shows a webhook creation mutation for a subscription payload:

mutation {
 webhookCreate(
   input: {
     app: "<app_id>"
     name: "test_product_updated_subscription"
     targetUrl: "<webhook_url>"
     asyncEvents: [PRODUCT_UPDATED]
     query: "subscription{event{...on ProductUpdated{product{id name}}}}"
   }
 ) {
   errors {
     field
     message
   }
   webhook {
     id
   }
 }
}

A payload generated from the subscription will have all the fields that you requested, plus some meta fields. You can see the payload example below:

{
   "product": {
     "id": "UHJvZHVjdDo3Ng==",
     "name": "Coconut Juice"
   },
   "meta": {
     "issuedAt": "2022-03-23T14:37:27.084275+00:00",
     "version": "dev",
     "issuingPrincipal": {
       "id": "<id>",
       "type": "user"
     }
   }
 }

Learn more in our documentation.

Public OIDC plugin

The OpenID Connect plugin allows you to integrate with your OAuth provider. This will allow you to move the authentication process to an external provider. And now, the plugin is available for everyone!

Learn more about the OpenID Connect plugin in our documentation.

New webhook events

Webhooks allow users to integrate Saleor with external services. Asynchronous webhook events can be used to receive data from Saleor when particular events happen. As a result, app operations are not sent back to Saleor. We’ve improved that feature by adding new asynchronous webhook events related to shipping and categories.

  • CATEGORY_CREATED

  • CATEGORY_UPDATED

  • CATEGORY_DELETED

  • SHIPPING_PRICE _ UPDATED

  • SHIPPING_PRICE _ DELETED

  • SHIPPING_ZONE _ CREATED

  • SHIPPING_ZONE _ UPDATED

  • SHIPPING_ZONE _ DELETED

Learn more about asynchronous webhooks here.

Saleor 3.2 Changelog

We’ve also added a few life improvement features and fixed some bugs. You can find the full changelog here.

Migration guide

The migration guide can be found here.


Saleor 3.3

Full-text search for products

We introduced a new text search for products. This approach does not support substring matches. However, it gives us proper result ranking with different weights assigned to product names, attributes, and descriptions. RANK is no longer deprecated as the sorting option.

It also supports websearch expressions:

  • "foo bar" for word distance (proximity)
  • foo -bar for excluding terms
  • foo OR bar for alternatives

New API for fetching metadata

We’ve created an alternative API for fetching metadata. It makes working with metadata easier in languages like JS, where automatically unmarshalling a JSON structure happens. Learn more in the following Pull Request.

New webhook events

We continue improving webhooks by adding new ones. We’ve added new asynchronous webhooks related to channels and gift cards.

  • CHANNEL_CREATED

  • CHANNEL_UPDATED

  • CHANNEL_DELETED

  • CHANNEL_STATUS _ CHANGED

  • GIFT_CARD _ CREATED

  • GIFT_CARD _ UPDATED

  • GIFT _ CARD _ DELETED

  • GIFT_STATUS _ CHANGED

Saleor 3.3 Changelog

Check the full changelog to learn more about what we’ve delivered with v3.3.


Thank you

This article highlighted some of the key changes and improvements in both Saleor 3.2 and 3.3. A big thank you to all contributors and community members for their input! We appreciate each and every piece of feedback.

Follow our Twitter and sign up for our newsletter to stay up to date with the latest info about Saleor!

Cheers!

— Share

You can also read

View all