Home > @shopware-pwa/shopware-6-client

# shopware-6-client package

# Functions

Function Description
addCartItems(items, contextInstance) Adds multiple items to the cart. Accepts every type of cart item.
addProductReview(productId, productReviewData, contextInstance) Add a review to specific product by its ID
addProductToCart(productId, quantity, contextInstance) Adds specific quantity of the product to the cart by productId. It creates a new cart line item.Warning: This method does not change the state of the cart in any way if productId already exists in a cart. For changing the quantity use addQuantityToCartLineItem() or changeCartLineItemQuantity() methods.
addPromotionCode(promotionCode, contextInstance) Adds new promotion code to the cart by its code.Promotion code is being added as separate cart item line.
cancelOrder(orderId, contextInstance) Cancel an order
changeCartItemQuantity(itemId, newQuantity, contextInstance) Changes the current quantity in specific cart line item to given quantity.Example: If current quantity is 3 and you pass 2 as quantity parameter, you will get a new cart's state with quantity 2.
changeOrderPaymentMethod(orderId, paymentMethodId, contextInstance) Change payment method for given order
clearCart(contextInstance) When no sw-context-token given then this method return an empty cart with the new sw-context-token.When sw-context-token given then this method simply returns the current state of the cart.As the purpose of this method is not clear we recommend to use getCart method because its behaviour seems to be the same.
confirmAccountRegistration(params, contextInstance) Confirm an account registration in double opt-in mode
confirmPasswordReset(params, contextInstance) Confirm a customer's password reset. Set new password for account.
createCustomerAddress(params, contextInstance) Create an address and respond the new address's id
createOrder(contextInstance) Creates an order for logged in users
deleteCustomerAddress(addressId, contextInstance) Delete's the customer's address by id
getAvailableCountries(contextInstance) Get all available countries
getAvailablePaymentMethods(contextInstance, params)
getAvailableSalutations(contextInstance) Get all available salutations
getAvailableShippingMethods(contextInstance, params)
getCart(contextInstance) Gets the current cart for the sw-context-token.
getCategories(searchCriteria, contextInstance)
getCategory(categoryId, contextInstance)
getCategoryProducts(categoryId, criteria, contextInstance) Get default amount of products and listing configuration for given category
getCmsPage(path, criteria, contextInstance)
getCustomer(parameters, contextInstance) Get customer's object
getCustomerAddress(addressId, contextInstance) Get the customer's address by id
getCustomerAddresses(parameters, contextInstance) Get all customer's addresses
getCustomerOrders(parameters, contextInstance) Get all customer's orders
getOrderDetails(orderId, params, contextInstance) Get order details
getPaymentMethodDetails(paymentId, contextInstance)
getProduct(productId, params, contextInstance) Get the product with passed productId
getProducts(criteria, contextInstance) Get default amount of products
getSeoUrls(entityId, languageId, contextInstance) Returns an array of SEO URLs for given entity Can be used for other languages as well by providing the languageId
getSessionContext(contextInstance) Loads session context, containing all session-related data.
getShippingMethodDetails(shippingId, contextInstance)
getStoreNavigation({ requestActiveId, requestRootId, depth, buildTree, searchCriteria, }, contextInstance)
getUserCountry(countryId, contextInstance)
getUserSalutation(salutationId, contextInstance)
handlePayment(orderId, finishUrl, errorUrl, contextInstance)
invokeGet({ address }, contextInstance) Invoke custom GET request to shopware API. Mostly for plugins usage. You can skip domain and pass only endpoint ex. /api/my/endpoint
invokePost({ address, payload, }, contextInstance) Invoke custom POST request to shopware API. Mostly for plugins usage. You can skip domain and pass only endpoint ex. /api/my/endpoint
login({ username, password }, contextInstance) Login user to shopware instance.
logout(contextInstance) End up the user session.
newsletterSubscribe(params, contextInstance)
newsletterUnsubscribe({ email, }, contextInstance)
register(params, contextInstance) Register a customer
removeCartItem(itemId, contextInstance) Deletes the cart line item by id.This method may be used for deleting "product" type item lines as well as "promotion" type item lines.
resetPassword(params, contextInstance) Reset a customer's password
searchProducts(criteria, contextInstance) Search for products based on criteria. From: Shopware 6.4
searchSuggestedProducts(criteria, contextInstance) Search for suggested products based on criteria. From: Shopware 6.4
sendContactForm(params, contextInstance)
setCurrentBillingAddress(billingAddressId, contextInstance) Set the current session's billing address to correspoding to id
setCurrentCurrency(newCurrencyID, contextInstance)
setCurrentLanguage(newLanguageId, contextInstance)
setCurrentPaymentMethod(newPaymentMethodId, contextInstance)
setCurrentShippingAddress(shippingAddressId, contextInstance) Set the current session's shipping address to correspoding to id
setCurrentShippingMethod(newShippingMethodId, contextInstance)
setDefaultCustomerBillingAddress(addressId, contextInstance) Set address as default
setDefaultCustomerShippingAddress(addressId, contextInstance) Set address as default
updateCustomerAddress(params, contextInstance) Update an address for specific ID
updateEmail(params, contextInstance) Update a customer's email
updatePassword(params, contextInstance) Update a customer's password
updateProfile(params, contextInstance) Update a customer's profile data

# Interfaces

Interface Description
GetStoreNavigationParams More about the navigation parameters: https://docs.shopware.com/en/shopware-platform-dev-en/store-api-guide/navigation?category=shopware-platform-dev-en/store-api-guide

# Variables

Variable Description
getCancelOrderEndpoint (BETA)
getCategoryDetailsEndpoint (BETA)
getCategoryEndpoint (BETA)
getChangeOrderPaymentMethodEndpoint (BETA)
getCheckoutCartEndpoint (BETA)
getCheckoutCartLineItemEndpoint (BETA)
getCheckoutOrderEndpoint (BETA)
getConfirmPasswordResetEndpoint (BETA)
getContactFormEndpoint (BETA)
getContextCountryEndpoint (BETA)
getContextCurrencyEndpoint (BETA)
getContextEndpoint (BETA)
getContextLanguageEndpoint (BETA)
getContextPaymentMethodEndpoint (BETA)
getContextSalutationEndpoint (BETA)
getContextShippingMethodEndpoint (BETA)
getCustomerAddAddressEndpoint (BETA)
getCustomerAddressEndpoint (BETA)
getCustomerDefaultBillingAddressEndpoint (BETA)
getCustomerDefaultShippingAddressEndpoint (BETA)
getCustomerDetailsUpdateEndpoint (BETA)
getCustomerEndpoint (BETA)
getCustomerLoginEndpoint (BETA)
getCustomerLogoutEndpoint (BETA)
getCustomerOrderEndpoint (BETA)
getCustomerRegisterEndpoint (BETA)
getCustomerResetPasswordEndpoint (BETA)
getCustomerUpdateEmailEndpoint (BETA)
getCustomerUpdatePasswordEndpoint (BETA)
getNewsletterSubscribeEndpoint (BETA)
getNewsletterUnsubscribeEndpoint (BETA)
getPageResolverEndpoint (BETA)
getProductDetailsEndpoint (BETA)
getProductEndpoint (BETA)
getProductListingEndpoint (BETA)
getSearchEndpoint (BETA)
getSeoUrlEndpoint (BETA)
getStoreNavigationEndpoint (BETA)
getStoreNewsletterConfirmEndpoint (BETA)
getStoreNewsletterSubscribeEndpoint (BETA)
getStoreNewsletterUnsubscribeEndpoint (BETA)
getSuggestSearchEndpoint (BETA)
handlePaymentEndpoint (BETA)
setup Setup configuration. Merge default values with provided in param. This method will override existing config. For config update invoke **update** method.
update Update current configuration. This will change only provided values.