Home > @vue-storefront/magento-api

magento-api package

Api Client for Magento 2 integration for Vue Storefront 2.


The @vue-storefront/magento-api library includes Apollo Client, GraphQL operations and Middleware endpoints that allow you to communicate with Magento.


Function Description
addConfigurableProductsToCart(context, input, customQuery, customHeaders) Adds a set of configurable products to a specified cart
addDownloadableProductsToCart(context, input, customQuery, customHeaders) Adds a set of downloadable products to a specified cart
addProductsToCart(context, input, customQuery, customHeaders) Adds products to the specified cart
addVirtualProductsToCart(context, input, customQuery, customHeaders) Adds a set of virtual products to a specified cart
applyCouponToCart(context, input, customQuery, customHeaders) Applies a coupon to a given card
cart(context, cartId, customQuery, customHeaders) Fetches a cart by its ID
categoryList(context, params, customQuery, customHeaders) Fetches the category list.
categorySearch(context, filters, customQuery, customHeaders) Searches for categories using received filters.
cmsBlocks(context, identifiers, customQuery, customHeaders) Fetch CMS Blocks from Magento Api.
cmsPage(context, identifier, customQuery, customHeaders) Fetch CMS Page from Magento
countries(context, customQuery, customHeaders) Loads the list of countries
country(context, id, customQuery, customHeaders) Fetches the information about a country given its ID
createCustomerAddress(context, input, customQuery, customHeaders) Creates a customer address.
currency(context, customQuery, customHeaders) Fetches the currency information.
customerCart(context, customQuery, customHeaders) Fetches the cart of the current logged in user
deleteCustomerAddress(context, addressId, customQuery, customHeaders) Deletes a customer address.
getAvailableCustomerShippingMethods(context, customQuery, customHeaders) Retrive available shipping methods for current customer
getAvailablePaymentMethods(context, params, customQuery, customHeaders) Fetches the available payment methods for the received cart.
getCustomerAddresses(context, customQuery, customHeaders) Fetches customer addresses.
placeOrder(context, input, customQuery, customHeaders) Places an order for received cart.
productDetail(context, searchParams, customQuery, customHeaders) Fetches the list of products with details using sort, filters and pagination.
products(context, searchParams, customQuery, customHeaders) Fetches products using received search term and params for filter, sort and pagination.
relatedProduct(context, searchParams, customQuery, customHeaders) Searches for related products using params for sorting, filtering and pagination.
removeCouponFromCart(context, input, customQuery, customHeaders) Removes a coupon from a cart
removeItemFromCart(context, input, customQuery, customHeaders) Removes an item from the given cart
requestPasswordResetEmail(context, input, customQuery, customHeaders) Requests a password reset email to be sent to the user
resetPassword(context, input, customQuery, customHeaders) Resets a user's password
route(context, url, customQuery, customHeaders) Returns the canonical URL for a specified product, category, or CMS page
setGuestEmailOnCart(context, input, customQuery, customHeaders) Set the guest user email on the cart
setPaymentMethodOnCart(context, input, customQuery, customHeaders) Sets received payment method on cart.
setShippingAddressesOnCart(context, input, customQuery, customHeaders) Sets a shipping address on received cart.
setShippingMethodsOnCart(context, input, customQuery, customHeaders) Sets a shipping method on received cart.
storeConfig(context, customQuery, customHeaders) Fetches the store configuration from the API
subscribeEmailToNewsletter(context, { email }, customQuery, customHeaders) Subscribes an email in the newsletter.
updateCartItems(context, input, customQuery, customHeaders) Updates the contents of the given cart
updateCustomerAddress(context, params, customQuery, customHeaders) Updates a customer address.
urlResolver(context, url, customQuery, customHeaders) Fetches the resolver for received URL.


Variable Description
availableStores Returns list of available stores
changeCustomerPassword Changes password of the current customer. To override the default query, use the changeCustomerPassword query key.
createCustomer Registers a new customer. To override the default query, use the createCustomer query key.
createProductReview Creates a new product review
customer Returns the information about the current customer. To override the default query, use the customer query key.
customerOrders Returns customer orders. To override the default query, use the customerOrders query key.
customerProductReview Returns product reviews created by the current customer
generateCustomerToken Logs in the customer based on provided username and password. To override the default query, use the generateCustomerToken query key.
productReview Returns reviews of the provided product
productReviewRatingsMetadata Returns additional product reviews data
revokeCustomerToken Logs out the current customer. To override the default query, use the revokeCustomerToken query key.
updateCustomer Updates the data of the current customer. To override the default query, use the updateCustomer query key.
upsellProduct Returns upsell products matching the provided parameters. To override the default query, use the upsellProducts query key.