younifyd
Menu

discountCodeBxgyUpdate

Updates a buy X get Y discount (BXGY) that's applied on a cart and at checkout when a customer enters a code.

Use it in a workflow

  1. Add a step and choose the Shopify connector.
  2. Pick the discountCodeBxgyUpdate action (under Discount).
  3. Fill in the fields below, then reference the result from later steps as {{discountcodebxgyupdate.response.data}}.

Query

This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
mutation DiscountCodeBxgyUpdate($id: ID!, $bxgyCodeDiscount: DiscountCodeBxgyInput!) {
  discountCodeBxgyUpdate(id: $id, bxgyCodeDiscount: $bxgyCodeDiscount) {
    codeDiscountNode {
      codeDiscount
      id
    }
    userErrors {
      code
      extraInfo
      field
      message
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

idstringrequired

The ID of the BXGY code discount to update.

bxgyCodeDiscountobjectrequired

The input data used to update the BXGY code discount.

combinesWithobject4 fields
titlestring
startsAtstring
endsAtstring
appliesOncePerCustomerboolean
codestring
customerSelectionobject3 fields
usageLimitnumber
contextobject4 fields
tagsarray<string>
customerBuysobject4 fields
customerGetsobject4 fields
usesPerOrderLimitnumber
json
{
  "id": "string",
  "bxgyCodeDiscount": {
    "combinesWith": {
      "productDiscounts": false,
      "orderDiscounts": false,
      "shippingDiscounts": false,
      "productDiscountsWithTagsOnSameCartLine": {
        "add": "string",
        "remove": "string"
      }
    },
    "title": "string",
    "startsAt": "string",
    "endsAt": "string",
    "appliesOncePerCustomer": false,
    "code": "string",
    "customerSelection": {
      "all": false,
      "customers": {
        "add": "string",
        "remove": "string"
      },
      "customerSegments": {
        "add": "string",
        "remove": "string"
      }
    },
    "usageLimit": 0,
    "context": {
      "all": "ALL",
      "customers": {
        "add": "string",
        "remove": "string"
      },
      "customerSegments": {
        "add": "string",
        "remove": "string"
      },
      "markets": {
        "add": "string",
        "remove": "string"
      }
    },
    "tags": [
      "string"
    ],
    "customerBuys": {
      "value": {
        "quantity": "string",
        "amount": "string"
      },
      "items": {
        "products": "string",
        "collections": "string",
        "all": "string"
      },
      "isOneTimePurchase": false,
      "isSubscription": false
    },
    "customerGets": {
      "value": {
        "discountOnQuantity": "string",
        "percentage": "string",
        "discountAmount": "string"
      },
      "items": {
        "products": "string",
        "collections": "string",
        "all": "string"
      },
      "appliesOnOneTimePurchase": false,
      "appliesOnSubscription": false
    }
  }
}

Response

Read the result with {{discountcodebxgyupdate.response.data.data.discountCodeBxgyUpdate}}. If the API returns errors, the step fails and they are at {{discountcodebxgyupdate.response.data.errors}}.

codeDiscountNodeobject
codeDiscountobject33 fields

This field can return one of several different object shapes — properties from every possible shape are shown together.

idstring
userErrorsarray<object>
codeobject
extraInfoobject
fieldobject
messageobject

Need more? See the Shopify guide for connection setup and behaviour shared by every action.