What's new? - Medusa v1.2
Tags: webdev, javascript, showdev, ecommerce
Published: 2022-02-28 17:27:57

Features and fixes included in the release of v.1.2 of [Medusa](https://github.com/medusajs/medusa) and [Medusa Admin](https://github.com/medusajs/admin). The larger issues/tickets built in this release will be highlighted with a small detailed description.

For the full changelog see, go [here](https://www.medusajs.com/post/whats-new-in-medusa-1-2).

## Release highlights

### Tax API

The Tax API allows you to configure your store to charge taxes from your customers to be in compliance with tax regulations in the markets you operate in. Tax regulations differ a lot across countries so Medusa’s tax system gives you a number of possibilities for configuring your taxes to ensure that you charge your customers the correct amount of tax.

You configure taxes on a region-basis meaning you can use different tax settings based on where customers are shopping from. Each region may use one of two tax modes:

- **Automatic Taxes** 
Tax totals are computed automatically on every cart update and retrieval. This is the default tax mode.

- **Manual Taxes**
Tax totals have to be manually computed by calling `POST /store/carts/:id/taxes`. This mode is more appropriate for tax configurations that use a plugin that calls 3rd party APIs. By using manual tax calculations you avoid 3rd party calls as part of the usual retrieval of carts.

The process for computing the tax total is the same regardless of the mode used. The steps taken are outlined in the figure below


![Tax API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eimqsfh98c424ck6145k.png)

A more elaborate walkthrough of the Tax API will soon be published to our documentation.

### Strategies

The new strategy pattern allows you to override core logic in Medusa in cases where such overrides are necessary. For example, if a merchant wants to apply custom logic when generating line items in a cart; a strategy can be overridden to accommodate this. Check out the first two implementations of the strategy pattern:

- [TaxCalculationStrategy](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/strategies/tax-calculation.ts)
- [CartCompletionStrategy](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/strategies/cart-completion.ts)

### CustomerGroup

This release introduces a notion of a CustomerGroup, which is the first element of our Promotions API. The feature allows you to group customers together and will play a key part in adding more advanced promotions, since you will be able to define discounts for entire customer groups ultimately allowing you to support VIP segments, wholesale customers, and much more.

```bash
CustomerGroup
- id: string
- name: string
- customers: Customer[]
```

Read our [discussion on the Promotions API](https://github.com/medusajs/medusa/discussions/1037) and feel free to pitch in with feedback and / or input.

### Global search

Global search has been added to Medusa Admin meaning that you will be able to search for Discounts, Orders, Customers, and GiftCards from anywhere in your admin system. The feature is the ultimate productivity booster for store managers and customer service by allowing you to navigate to an order with as little as three clicks; 1) open search (with keyboard shortcuts), 2) paste order number, 3) press enter. 

Check out a small gif below.


![global-search-gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgft2lvth1gs4f4p1ppe.gif)

### Add error handler in `atomicPhase_` to allow clean up when transactions fail

Introduce a new way of gracefully handling errors in our atomic phases by adding an error handler param to the `atomicPhase_`. The case to solve for is when work is performed within a transaction, but the transactions fail and cleanup is needed. 

Read more about the feature and what is solved for in the [pull request](https://github.com/medusajs/medusa/pull/1104).

---

## What’s next?

Introducing customer groups was the first step towards building the Promotions API, and the focus next will be to refactor our discount rules to be much more advanced, such that you can create discounts per product type, tag and collection as well as customer groups. 

Additionally, the MoneyAmount entity will be extended to allow for advanced pricelists meaning you will be able to define variant prices per customer, add a MoneyAmount type, and more.

Stay tuned on our [Discord](https://discord.com/invite/medusajs) or via our [webpage](https://www.medusajs.com/)!