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

Adjust API for gift promotion rule #15224

Closed
Tracked by #15075
IKarbowiak opened this issue Jan 11, 2024 · 0 comments · Fixed by #15274
Closed
Tracked by #15075

Adjust API for gift promotion rule #15224

IKarbowiak opened this issue Jan 11, 2024 · 0 comments · Fixed by #15274
Assignees

Comments

@IKarbowiak
Copy link
Member

IKarbowiak commented Jan 11, 2024

Part of #15075

API changes

Mutations

  • Update the promotion inputs with gifts field
  • Update the following mutations: promotionCreate, PromotionRuleCreate, promotionRuleUpdate:
    • Require the gifts field when the GIFT reward type is chosen
    • rewardValueType, rewardValue, rewardPredicate should be empty - raise an ValidationError otherwise
    • Validate gifts field - the provided IDs must be the ProductVariant ids
  • Update CheckoutLinesUpdate - don't allow to update quantity of lines marked as gift line
  • Update OrderLineUpdate - don't allow to update quantity of lines marked as gift line
  • Update checkoutLineDelete and CheckoutLinesDelete - do not allow deleting gift lines
input PromotionRuleInput @doc(category: "Discounts") {
  ...
  gifts: [ID!]
}

input PromotionRuleCreateInput @doc(category: "Discounts") {
  ...
  gifts: [ID!]
}

input PromotionRuleUpdateInput @doc(category: "Discounts") {
  ...
   gifts: [ID!]
}

Types

  • Extend PromotionRule with giftIds
  • Extend PromotionRule withgiftsLimit - will define the maximum number of gifts to choose from the gifts list. For now, we will always return 1, and it won't be configurable for now
  • Extend RewardTypeEnum with GIFT
  • Extend OrderLine and CheckoutLine with isGift flag
  • Consider adding filter for getting lines that are gifts
type PromotionRule implements Node @doc(category: "Discounts"){
  ...
  giftIds: [ID!]
  giftsLimit: Int
}

enum RewardTypeEnum @doc(category: "Discounts") {
  ...
  GIFT
}

type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {
  ...
  isGift: Boolean!
}

type CheckoutLine implements Node & ObjectWithMetadata @doc(category: "Checkout") {
  ...
  isGift: Boolean!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants