• Tuesday, 18 March 25 06:08

    Create customer By Graphql Mutation

    We can create custom mutation for create customer by graphql. For that we can create custom request and response query string.

    Step 1. Create a schema.graphqls file in your module's etc directory.

    Copy
                                        
    type Mutation { createCustomerAccount( id: String @doc(description: "Id of requested resource") firstname: String! @doc(description: "The customer's name") lastname: String @doc(description: "The customer's family name") phone: String! @doc(description: "The customer's Phone number") email: String! @doc(description: "The customer's email address. Required") password: String @doc(description: "The customer's password") gender: String @doc(description: "The customer's gender") registrationchannel: Channel @doc(description: "The customer's registration channel") ): CreateCustomerResponse @resolver(class: "\\Vendor\\CustomerLogin\\Model\\Resolver\\CreateCustomer") @doc(description:"Create customer account") } enum Channel { WEB SOCIAL APP } type CreateCustomerResponse { status: Boolean @doc(description: "Request Status") message: String @doc(description: "Success Message") }

    Continue...

  • Tuesday, 18 March 25 01:27

    Graphql Mutation for customer update in magento 2

    Update customer by graphql Mutation. With existing fields, If you want to update your customer field you need to add that field in schema.graphqls input CustomerInput

    GraphQL mutation is used for updating data; it is similar to POST API. You can run a customer update mutation that needs a customer token.
    In header you can set the customer Barrar Token "Authorization: Bearer bvnqda5g61zt3w6gxxxo0t222ubgcj4k"

    Copy
                                        
    mutation{ updateCustomer(input: { email:"ajeets@gamil.com" firstname: "Ajeet" }) { customer { email firstname } } }

    Continue...

Copyright © 2013-present Magento, Inc. All rights reserved.