Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move OrderSettings to Channel type #11337

Closed
Tracked by #11550
korycins opened this issue Nov 29, 2022 · 1 comment · Fixed by #11417
Closed
Tracked by #11550

Move OrderSettings to Channel type #11337

korycins opened this issue Nov 29, 2022 · 1 comment · Fixed by #11417
Assignees
Labels
rfc Request For Comments: blueprints of upcoming changes.
Milestone

Comments

@korycins
Copy link
Member

korycins commented Nov 29, 2022

What I'm trying to achieve

I would like to move OrderSettings from Query and place them inside a Channel type. Same way as we have stockSettings inside Channel. The proposed approach will allow us to configure order settings per channel.

Describe a proposed solution

Channel

Channel type will have a new field:

"""Represents channel."""
type Channel implements Node {
  id: ID!
  ...
 """
  Define the stock setting for this channel.
  
  Added in Saleor 3.7.
  
  Note: this API is currently in Feature Preview and can be subject to changes at later point.
  
  Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
  """
  stockSettings: StockSettings!
  """MANAGE_ORDERS or MANAGE_CHANNELS"""
  orderSettings: OrderSettings!
}

Permission MANAGE_ORDERS or MANAGE_CHANNELS will be required to fetch orderSettings.

The channelCreate and channelUpdate mutations will get new input fields:

input OrderSettingsInput {
  """
  When disabled, all new orders from checkout will be marked as unconfirmed. When enabled orders from checkout will become unfulfilled immediately.
  """
  automaticallyConfirmAllNewOrders: Boolean

  """
  When enabled, all non-shippable gift card orders will be fulfilled automatically.
  """
  automaticallyFulfillNonShippableGiftCard: Boolean
}
input ChannelUpdateInput {
  """
  The channel stock settings.
  
  Added in Saleor 3.7.
  
  Note: this API is currently in Feature Preview and can be subject to changes at later point.
  """
  stockSettings: StockSettingsInput
  ...
  
  orderSettings: OrderSettingsInput

Permission MANAGE_ORDERS or MANAGE_CHANNELS will be required to update orderSettings.
MANAGE_ORDERS can be used only when channelUpdate mutation will get OrderSettingsInput and not any other fields will be updated. Otherwise needed permission will be MANAGE_CHANNELS

input ChannelCreateInput {
  """
  The channel stock settings.
  
  Added in Saleor 3.7.
  
  Note: this API is currently in Feature Preview and can be subject to changes at later point.
  """
  stockSettings: StockSettingsInput
  ...
  orderSettings: OrderSettingsInput

OrderSettings

The OrderSettings type already exists:

type OrderSettings {
  automaticallyConfirmAllNewOrders: Boolean!
  automaticallyFulfillNonShippableGiftCard: Boolean!
}

Mutation orderSettingsUpdate will be deprecated:

  """
  Update shop order settings. 
  
  Requires one of the following permissions: MANAGE_ORDERS.
  """
  orderSettingsUpdate(
    """Fields required to update shop order settings."""
    input: OrderSettingsUpdateInput!
  ): OrderSettingsUpdate

The description will suggest using channelUpdate mutation to update orderSettings.
In case of calling deprecated OrderSettingsUpdate mutation, records for all channels will be updated.

The query orderSettings will be deprecated:

orderSettings: OrderSettings

The query will return results for first channel in alphabetical order.
In the case of using the deprecated mutation orderSettingsUpdate and deprecated query orderSettings the returned data will always be correct.

Other solutions I've tried and won't work

I was also thinking about extending a Shop type, but Channel sounds better, as we already have there a stockSettings.

@korycins korycins added the rfc Request For Comments: blueprints of upcoming changes. label Nov 29, 2022
@korycins korycins self-assigned this Nov 29, 2022
@IKarbowiak
Copy link
Member

LGTM 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfc Request For Comments: blueprints of upcoming changes.
Projects
Status: Shipped 🚚
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants