Issue with functionId while creating coupon using discountCodeAppCreate

Solved

Issue with functionId while creating coupon using discountCodeAppCreate

rkmsoftware
Shopify Partner
20 1 6

Hi,

We are trying to achieve a feature within our custom app where we can create and merge two coupons into one as some of the apps doing now. But we are not able to achieve that using API resources. Can you please more information when we're trying to get functionId using appDiscountTypes but we are getting an error in response Shop requires beta flag to access this.

 

@shopify_apps 

Fullstack Developer
Accepted Solution (1)
rkmsoftware
Shopify Partner
20 1 6

This is an accepted solution.

Helping Hand 🙂
I had found an alternate solution for this. where I use graphQL to generate draft orders and combine both codes in a single order.

Here is snippet:

 

mutation draftOrderCreate($input: DraftOrderInput!) {
  draftOrderCreate(input: $input) {
    draftOrder {
      id
      totalPrice
    }
    userErrors {
      field
      message
    }
  }
}
{
  "input": {
    "appliedDiscount": {
      "amount": "1.00",
      "description": "Coupon Combine APP",
      "title": "IJ6H3azA4SVsIyX3FxzW + FhWzxd3kl0y5spnBGiTV",
      "value": 0.80,
      "valueType": "FIXED_AMOUNT"
    },
    "email": "sample@email.net",
    "lineItems": [
      {
        "originalUnitPrice": "416.67",
        "quantity": 1,
        "requiresShipping": true,
        "sku": "sku",
        "taxable": true,
        "title": "title",
        "variantId": "gid://shopify/ProductVariant/xxxxxx"
      }
    ],
    "note": "",
    "shippingLine": {
      "price": "0.00",
      "shippingRateHandle": "",
      "title": "FREESHIP"
    },
    "useCustomerDefaultAddress": true
  }
}

 

 

Fullstack Developer

View solution in original post

Replies 2 (2)

MiN1One
Shopify Partner
4 0 0

Have the same issue

rkmsoftware
Shopify Partner
20 1 6

This is an accepted solution.

Helping Hand 🙂
I had found an alternate solution for this. where I use graphQL to generate draft orders and combine both codes in a single order.

Here is snippet:

 

mutation draftOrderCreate($input: DraftOrderInput!) {
  draftOrderCreate(input: $input) {
    draftOrder {
      id
      totalPrice
    }
    userErrors {
      field
      message
    }
  }
}
{
  "input": {
    "appliedDiscount": {
      "amount": "1.00",
      "description": "Coupon Combine APP",
      "title": "IJ6H3azA4SVsIyX3FxzW + FhWzxd3kl0y5spnBGiTV",
      "value": 0.80,
      "valueType": "FIXED_AMOUNT"
    },
    "email": "sample@email.net",
    "lineItems": [
      {
        "originalUnitPrice": "416.67",
        "quantity": 1,
        "requiresShipping": true,
        "sku": "sku",
        "taxable": true,
        "title": "title",
        "variantId": "gid://shopify/ProductVariant/xxxxxx"
      }
    ],
    "note": "",
    "shippingLine": {
      "price": "0.00",
      "shippingRateHandle": "",
      "title": "FREESHIP"
    },
    "useCustomerDefaultAddress": true
  }
}

 

 

Fullstack Developer