Custom node.js app - bundling through additional selections

MrBubble
Visitor
1 0 1

Hello,

 

I've been developing an application which would allow me to create bundled products (products with multiple checkbox, where each checkox have a price). A rough vizualisation would be a pizza with extra toppings, each of the topping costs extra. The idea is to use the product as a base, add custom options through custom app and display them on product view. I've successfully tried to modify the order (orderDraft) through graphql on DRAFT_ORDERS_CREATE hook:

mutation draftOrderUpdate($id: ID!, $input: DraftOrderInput!) {
   
draftOrderUpdate(id: $id, input: $input) {
      draftOrder {
         id
      }
    }
}
{
  "id": "gid://shopify/DraftOrder/853743730880",
  "input": {
   "lineItems": [
    {"title": "hello - world ?", "originalUnitPrice": 16, "quantity": 1 }
   ]
  }
}

however once I add there my custom line item through graphql modification - all the other line items are dissapearing.

 

Then I tried to modify the cart object through https://shopify.dev/api/storefront/reference/checkouts/cartlinesadd, however the following approach does not allow to add custom line items, only existing merchendise...

 

Any tips on how should I approach the issue ? (Paying for application is not an option for me 😞 )

Reply 1 (1)

elmorgan3
Shopify Partner
6 0 2

Hi @

What I used was this https://shopify.dev/api/ajax/reference/cart#post-cart-add-js, there are also a method to update the card, that could maybe help you.