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.
addWishlistProduct(productId, contextInstance) Add a product with a specific ID to the wishlist
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
createInstance(initialConfig)
createOrder(params, contextInstance) Creates an order for logged in and guest users
deleteCustomerAddress(addressId, contextInstance) Delete's the customer's address by id
getAvailableCountries(contextInstance) Get all available countries
getAvailableCurrencies(contextInstance)
getAvailableLanguages(contextInstance)
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
getLandingPage(landingPageId, params, contextInstance) Fetches a landing page entity
getOrderDetails(orderId, params, contextInstance) Get order details
getPaymentMethodDetails(paymentId, contextInstance)
getProduct(productId, params, contextInstance) Get the product with passed productId
getProductReviews(productId, criteria, contextInstance) Get product reviews
getProducts(criteria, contextInstance) Get default amount of products
getSeoUrl(params, contextInstance)
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)
getWishlistProducts(criteria, contextInstance) Fetch a current Wishlist with added products
handlePayment(params, 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
isNewsletterSubscriber(contextInstance) Checking if user is newsletter subscriber
login({ username, password }, contextInstance) Login user to shopware instance.
logout(contextInstance) End up the user session.
mergeWishlistProducts(productIds, contextInstance) Merge the current Wishlist with a products with provided IDs
newsletterSubscribe(params, contextInstance)
newsletterUnsubscribe(params, 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.
removeWishlistProduct(productId, contextInstance) Delete a product with a specific ID from the wishlist
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
setDefaultCustomerPaymentMethod(paymentMethodId, contextInstance) Set payment method under provided ID 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
ClientSettings
ConfigChangedArgs
ContactFormData
CustomerRegisterResponse
CustomerResetPasswordParam
CustomerUpdateEmailParam
CustomerUpdatePasswordParam
CustomerUpdateProfileParam
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
NewsletterSubscribeData
ShopwareApiInstance

# Variables

Variable Description
config
getAddWishlistProductEndpoint
getCancelOrderEndpoint
getCategoryDetailsEndpoint
getCategoryEndpoint
getChangeOrderPaymentMethodEndpoint
getCheckoutCartEndpoint
getCheckoutCartLineItemEndpoint
getCheckoutOrderEndpoint
getConfirmPasswordResetEndpoint
getContactFormEndpoint
getContextCountryEndpoint
getContextCurrencyEndpoint
getContextEndpoint
getContextLanguageEndpoint
getContextPaymentMethodEndpoint
getContextSalutationEndpoint
getContextShippingMethodEndpoint
getCustomerAccountConfirmEndpoint
getCustomerAddAddressEndpoint
getCustomerAddressEndpoint
getCustomerDefaultBillingAddressEndpoint
getCustomerDefaultShippingAddressEndpoint
getCustomerDetailsUpdateEndpoint
getCustomerEndpoint
getCustomerLoginEndpoint
getCustomerLogoutEndpoint
getCustomerOrderEndpoint
getCustomerRegisterEndpoint
getCustomerResetPasswordEndpoint
getCustomerUpdateEmailEndpoint
getCustomerUpdatePasswordEndpoint
getCustomerUpdatePaymentMethodEndpoint
getGetWishlistProductsEndpoint
getLandingPageDetailsEndpoint
getMergeWishlistProductsEndpoint
getNewsletterRecipientEnpoint
getNewsletterSubscribeEndpoint
getNewsletterUnsubscribeEndpoint
getPageResolverEndpoint
getProductDetailsEndpoint
getProductEndpoint
getProductListingEndpoint
getProductReviewsEndpoint
getRemoveWishlistProductEndpoint
getSearchEndpoint
getSeoUrlEndpoint
getStoreNavigationEndpoint
getStoreNewsletterConfirmEndpoint
getStoreNewsletterSubscribeEndpoint
getStoreNewsletterUnsubscribeEndpoint
getSuggestSearchEndpoint
handlePaymentEndpoint
onConfigChange
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.