Shopify Javascript API

Customize your request with a quote experience with custom development

Jonathan Muschalle avatar
Written by Jonathan Muschalle
Updated over a week ago

Please note that this feature is currently outside the scope of our Support Team's assistance. If you wish to utilize this feature, you may need to engage your own developer or technical resource for implementation and support.

QuoteMachine exposes a global object in javascript to allow theme developers to customize the "Request a quote" experience.

As long as the "QuoteMachine Cart Modal" app embed is enabled, you'll have access to the global object on every page.

The global object is stored in window and can be accessible from window.QuoteMachineService. You can use it directly in your code.

Here are the different methods of the global object:

Add to quote: window.QuoteMachineService.addToQuote(items)

This method adds one or more variants to the quote cart, it returns a promise

Parameters:

  • items: Array of Item

    // example:
    [
    {
    variantId: "123456",
    quantity: "2",
    },
    {
    variantId: "654321",
    quantity: "1",
    },
    ]

    • Item:

      • variantId: (String) shopify variant ID

      • quantity: (String) quantity of that variant to add to the cart

Open the cart: window.QuoteMachineService.openCartModal()

This method will open the cart modal

Did this answer your question?