--- displayed_sidebar: servicesSidebar --- import TypeList from "@site/src/components/TypeList" # ShippingOptionService Provides layer to manipulate profiles. ## constructor ### Parameters ___ ## Properties `","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"__moduleDeclaration__","type":"`Record`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="ShippingOptionService"/> ___ ## Accessors ### activeManager\_ #### Returns ___ ## Methods ### withTransaction #### Parameters #### Returns ### shouldRetryTransaction\_ #### Parameters ` \\| `object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="shouldRetryTransaction_"/> #### 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":[]}]} sectionTitle="atomicPhase_"/> #### Returns ### validateRequirement\_ Validates a requirement #### Parameters #### Returns ### list #### Parameters #### Returns ### listAndCount #### Parameters #### Returns ### retrieve Gets a profile by id. Throws in case of DB Error and if profile was not found. #### Parameters #### Returns ### updateShippingMethod Updates a shipping method's associations. Useful when a cart is completed and its methods should be copied to an order/swap entity. #### Parameters #### Returns ### deleteShippingMethods Removes a given shipping method #### Parameters #### Returns ### createShippingMethod Creates a shipping method for a given cart. #### Parameters `","description":"the optional provider data to use.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config","type":"`CreateShippingMethodDto`","description":"the cart to create the shipping method for.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="createShippingMethod"/> #### Returns ### validateCartOption Checks if a given option id is a valid option for a cart. If it is the option is returned with the correct price. Throws when region\_ids do not match, or when the shipping option requirements are not satisfied. #### Parameters #### Returns ### validateAndMutatePrice #### Parameters #### Returns ### create Creates a new shipping option. Used both for outbound and inbound shipping options. The difference is registered by the `is_return` field which defaults to false. #### Parameters #### Returns ### validatePriceType\_ Validates a shipping option price #### Parameters #### Returns ### update Updates a profile. Metadata updates and product updates should use dedicated methods, e.g. `setMetadata`, etc. The function will throw errors if metadata or product updates are attempted. #### Parameters #### Returns ### delete Deletes a profile with a given profile id. #### Parameters #### Returns ### addRequirement Adds a requirement to a shipping option. Only 1 requirement of each type is allowed. #### Parameters #### Returns ### removeRequirement Removes a requirement from a shipping option #### Parameters #### Returns ### updateShippingProfile #### Parameters #### Returns ### getPrice\_ Returns the amount to be paid for a shipping method. Will ask the fulfillment provider to calculate the price if the shipping option has the price type "calculated". #### Parameters `","description":"the shipping data to retrieve the price.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"cart","type":"`undefined` \\| [Order](../../entities/classes/entities.Order.mdx) \\| [Cart](../../entities/classes/entities.Cart.mdx)","description":"the context in which the price should be\n retrieved.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="getPrice_"/> #### Returns