--- displayed_sidebar: servicesSidebar --- import ParameterTypes from "@site/src/components/ParameterTypes" # ShippingProfileService Provides layer to manipulate profiles. ## Implements ## constructor ### Parameters ___ ## Properties `", "description": "", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "__container__", "type": "`any`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "__moduleDeclaration__", "type": "`Record`", "description": "", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "customShippingOptionService_", "type": "[CustomShippingOptionService](services.CustomShippingOptionService.mdx)", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "featureFlagRouter_", "type": "`FlagRouter`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "manager_", "type": "`EntityManager`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "productRepository_", "type": "Repository<[Product](../../entities/classes/entities.Product.mdx)> & `object`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "productService_", "type": "[ProductService](services.ProductService.mdx)", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "shippingOptionService_", "type": "[ShippingOptionService](services.ShippingOptionService.mdx)", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "shippingProfileRepository_", "type": "Repository<[ShippingProfile](../../entities/classes/entities.ShippingProfile.mdx)> & `object`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "transactionManager_", "type": "`undefined` \\| `EntityManager`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> ___ ## Accessors ### activeManager\_ #### Returns ___ ## Methods ### addProduct #### Parameters #### Returns #### Deprecated use [addProducts](services.ShippingProfileService.mdx#addproducts) instead ___ ### addProducts Adds a product or an array of products to the profile. #### Parameters #### Returns ___ ### addShippingOption Adds a shipping option to the profile. The shipping option can be used to fulfill the products in the products field. #### Parameters #### Returns ___ ### atomicPhase\_ Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created. #### Type Parameters #### Parameters Promise<TResult>", "description": "the transactional work to be done", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "isolationOrErrorHandler", "type": "`IsolationLevel` \\| (`error`: `TError`) => Promise<void \\| TResult>", "description": "the isolation level to be used for the work.", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "maybeErrorHandlerOrDontFail", "type": "(`error`: `TError`) => Promise<void \\| TResult>", "description": "Potential error handler", "optional": true, "defaultValue": "", "expandable": false, "children": [] } ]} /> #### Returns ___ ### create Creates a new shipping profile. #### Parameters #### Returns ___ ### createDefault Creates a default shipping profile, if this does not already exist. #### Returns ___ ### createGiftCardDefault Creates a default shipping profile, for gift cards if unless it already exists. #### Returns ___ ### delete Deletes a profile with a given profile id. #### Parameters #### Returns ___ ### fetchCartOptions Finds all the shipping profiles that cover the products in a cart, and validates all options that are available for the cart. #### Parameters #### Returns ___ ### getMapProfileIdsByProductIds #### Parameters #### Returns ___ ### getProfilesInCart Returns a list of all the productIds in the cart. #### Parameters #### Returns ___ ### list #### Parameters #### Returns ___ ### removeProducts Removes a product or an array of products from the profile. #### Parameters #### Returns ___ ### retrieve Gets a profile by id. Throws in case of DB Error and if profile was not found. #### Parameters #### Returns ___ ### retrieveDefault #### Returns ___ ### retrieveForProducts #### Parameters #### Returns ___ ### retrieveGiftCardDefault Retrieves the default gift card profile #### Returns ___ ### shouldRetryTransaction\_ #### Parameters ` \\| `object`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> #### Returns ___ ### update Updates a profile. Metadata updates and product updates should use dedicated methods, e.g. `setMetadata`, `addProduct`, etc. The function will throw errors if metadata or product updates are attempted. #### Parameters #### Returns ___ ### withTransaction #### Parameters #### Returns