Shipping not required

Solved

Shipping not required

alammediacarry
Shopify Partner
10 1 3

Hi there,

I am creating order on Shopify store using node with GQL Apis here is my code to create order:

 const orderPayload = {
    query: `
      mutation CreateOrder($order: OrderCreateOrderInput!) {
        orderCreate(order: $order) {
          order {
            id
            name
            totalPriceSet {
              shopMoney {
                amount
                currencyCode
              }
            }
            billingAddress {
              address1
              city
              province
              country
              zip
            }
            shippingAddress {
              address1
              city
              province
              country
              zip
            }
          }
          userErrors {
            field
            message
          }
        }
      }
    `,
    variables: {
      order: {
        email: orderData.customer.email,
        lineItems: lineItemsData.map((item) => ({
          variantId: `gid://shopify/ProductVariant/${item.variant_id}`,
          quantity: item.quantity,
        })),
        billingAddress: {
          address1: orderData.order.billing_address.address1,
          address2: orderData.order.billing_address.address2,
          city: orderData.order.billing_address.city,
          company: orderData.order.billing_address.company,
          country: orderData.order.billing_address.country,
          province: orderData.order.billing_address.province,
          zip: orderData.order.billing_address.zip,
          firstName: orderData.customer.first_name,
          lastName: orderData.customer.last_name,
          phone: orderData.customer.phone,
        },
        shippingAddress: {
          address1: orderData.order.shipping_address.address1,
          address2: orderData.order.shipping_address.address2,
          city: orderData.order.shipping_address.city,
          company: orderData.order.shipping_address.company,
          country: orderData.order.shipping_address.country,
          province: orderData.order.shipping_address.province,
          zip: orderData.order.shipping_address.zip,
          firstName: orderData.customer.first_name,
          lastName: orderData.customer.last_name,
          phone: orderData.customer.phone,
        },
        financialStatus: "PENDING", // Set financial status as PENDING
      },
    },
  };

In second step i am marking it as paid, here is my code:

 const mutationPayload = {
    query: `
      mutation MarkAsPaid($input: OrderMarkAsPaidInput!) {
        orderMarkAsPaid(input: $input) {
          order {
            id
            name
          }
          userErrors {
            field
            message
          }
        }
      }
    `,
    variables: {
      input: {
        id: `gid://shopify/Order/${orderId}`, // Global ID format for the order
      },
    },
  };

Now the thing is why in my order it is saying Shipping not required:
Screenshot 2024-12-31 202633.jpg

When i was working with REST APIs it was showing Shipping in Delivery method. 
Screenshot 2024-12-31 203123.jpg
Can anyone help in this

 
Accepted Solution (1)

alammediacarry
Shopify Partner
10 1 3

This is an accepted solution.

In the variable we need to add requireShipping status true.

 lineItems: lineItemsData.map((item) => ({
          variantId: `gid://shopify/ProductVariant/${item.variant_id}`,
          quantity: item.quantity,
          requiresShipping: true, 
        })),

View solution in original post

Replies 3 (3)
alammediacarry
Shopify Partner
10 1 3

I don’t need to provide proof in this case. Simply, it’s not my personal store, I’m a developer. We are building an app for our company, and in certain scenarios, we need to create orders on the store registered with us. Previously, I implemented this using our business logic with REST API, and it worked perfectly. However, as the industry shifts from REST to GraphQL, I’ve transitioned to using GraphQL for this process.

I’ve completed most of the implementation but encountered a missing piece. I’ve done some research, but as a MERN stack developer working on Shopify specifically for this project, I’m still seeking clarity on this issue. If you can understand this from a developer’s perspective, I would appreciate your guidance. Thank you!

alammediacarry
Shopify Partner
10 1 3

@Oladimejishop waiting for your reply, here is the proof too.

alammediacarry_0-1735667302150.png

 

alammediacarry
Shopify Partner
10 1 3

This is an accepted solution.

In the variable we need to add requireShipping status true.

 lineItems: lineItemsData.map((item) => ({
          variantId: `gid://shopify/ProductVariant/${item.variant_id}`,
          quantity: item.quantity,
          requiresShipping: true, 
        })),