16 Commits

Author SHA1 Message Date
Nicolas Gorga
d60ea7268a feat(translation,fulfillment,customer,product,region,tax,core-flows,medusa,types): Implement dynamic translation settings management (#14536)
* Add is_active field to translation_settings model

* Types

* Workflows

* Api layer

* Tests

* Add changeset

* Add comment

* Hook to create or deactivate translatable entities on startup

* Cleanup old code

* Configure translatable option for core entities

* Validation step and snake case correction

* Cleanup

* Tests

* Comment in PR

* Update changeset

* Mock DmlEntity.getTranslatableEntities

* Move validation to module service layer

* Remove validation from remaining workflow

* Return object directly

* Type improvements

* Remove .only from tests

* Apply snakeCase

* Fix tests

* Fix tests

* Remove unnecessary map and use set instead

* Fix tests

* Comments

* Include translatable product properties

* Avoid race condition in translations tests

* Update test
2026-01-14 07:09:49 -03:00
Nicolas Gorga
cec8b8e428 feat(core-flows,types,utils,medusa): Translate tax lines (#14359)
* Include locale field for traslations on tax line workflows

* Translate tax lines in getItemTaxLinesStep with new util

* Update tax calculation context, so that we pass locale to third party tax providers if they want to return translated tax rates

* Apply translations to tax lines on product and variant tax middlewares

* Cart management translations tests

* Update tax lines when order locale gets updated

* Add changeset

* Get tranlsated tax lines step

* Fix wording

* Mutate ref directly

* Update order tax lines translations upon order locale change

* Claims translations tests

* Update tax lines upon draft order locale update

* Exchange tests for tax lines translations

* Order edits test for tax line translation

* Add tests for shipping methods tax line translations on various order flows

* Returns shipping method translations tests

* Execute update in parallel

* Use TranslationFeatureFlag.key

* Fix feature flag import

* Add @medusajs/medusa dependency for feature flag usage

* Revert "Add @medusajs/medusa dependency for feature flag usage"

This reverts commit e8897aed0a88f83c1034ac73e817e4222250a2c9.

* Use feature flag string directly

* Fix test

* Parallelize tax line translations application
2026-01-13 15:12:42 -03:00
Nicolas Gorga
11de7e3e34 feat(translation,core-flows): translate remaining core entities and sync shipping option <> method translations (#14358)
* Get translated shipping options step

* Apply translations on shipping options list methods.

* Pass shipping option naem when refreshing cart shipping methods, so if locale changed, we update the name

* Update translatable fields config

* Cart shipping method update translation tests

* Shipping options translations tests

* Add changeset

* Update order shipping method translations on update

* Remove unnecessary workflow and use step instead

* Translate shipping method on order edit

* Use new update shipping methods tranlsations step

* Draft order shipping method translation sync

* Translate shipping method on order exchange

* Translate returns shipping methods

* Translate claims shipping methods

* Remove unnecessary check

* Early return

* Fix import

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2026-01-02 11:26:06 +01:00
Nicolas Gorga
8964a03fa1 chore(): Remove default_locale from StoreLocale (#14300)
## Summary

**What** — What changes are introduced in this PR?

Remove `default_locale` from Store <> Locale relation

**Why** — Why are these changes relevant or necessary?  

*Please provide answer here*

**How** — How have these changes been implemented?

*Please provide answer here*

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [ ] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.


Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-12-15 09:05:46 +00:00
Adrien de Peretti
f13c23a4b7 feat(): Sync order translations (#14267)
* feat(): Sync order translations

* feat(): Sync order translations

* tests

* Create tender-melons-develop.md

* fix tests

* cleanup

* cleanup
2025-12-11 15:40:11 +01:00
Nicolas Gorga
fea3d4ec49 fix(core-flows): Access orderItem.variant safely inside convertDraftOrderWorkflow when containing custom items (#14233)
* Access orderItem variant safely on convert draft order workflow

* Tests

* Add changest

* Remove .only from test
2025-12-08 08:56:05 -03:00
Nicolas Gorga
3e2991e447 fix(core-flows): create reservations on draft order conversion to regular order (#14010)
## Summary

**What** — What changes are introduced in this PR?

Avoid creating reservations when draft order edits are confirmed and rather, create them when the draft order is converted into a regular order.

**Why** — Why are these changes relevant or necessary?  

While the order is a draft, creating reservations would potentially block inventory for regular order requests, when the draft represents a non materialized state of a purchase that might never be completed or at a latter point in time.

**How** — How have these changes been implemented?

Removed the reservation creations inside of `confirmDraftOrderEditWorkflow` and instead do it inside `convertDraftOrderWorkflow`

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

Added integration tests.

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [x] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [x] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.

fixes #13773 
closes SUP-2523
2025-12-01 12:08:03 +00:00
Leonardo Benini
9c957e1da0 chore(core-flows): only allow published products in addToCartWorkflow (#13182)
Closes #13163 

I have a few questions about expected behaviour, since this currently breaks some tests:

- Many tests use the productModule to create products, with default status == "draft", and use the addToCart workflow which now throws. Should I change all breaking tests to specify status == "published" whne creating the product? The alternative would be to check the status in the store API route before the workflow but 1. it would be an extra query and 2. the addToCart workflow is only used in the store currently, and even if it was to be used admin-side, it still doesn't make sense to add a draft product to cart

- After this PR an unpublished product would give the same error as a variant that doesn't exist. While imho this is correct, the thrown error (for both) is "Items  do not have a price" which doesn't make much sense(i believe the workflows goes through with an empty variants list and then errors at the price check point). Should I throw a different error when a variant doesn't exists/isn't published?


---

> [!NOTE]
> Enforces that only variants from published products can be added to carts, adds status fetching, refines errors, and updates tests to use ProductStatus.PUBLISHED.
> 
> - **Core Flows**:
>   - addToCart: Validate variants exist and belong to `product.status = PUBLISHED`; throw clear `INVALID_DATA` when not found/unpublished.
>   - Data fetching: Include `product.status` in `cart` and `order` variant field selections.
> - **Tests/Fixtures**:
>   - Update integration tests to set `status: ProductStatus.PUBLISHED` when creating products and import `ProductStatus` where needed.
>   - Add cases for unpublished products and non-existent variants producing the new error message.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ca72532e957964d2d8e6bcecbb0905054c677ded. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-10-02 12:31:53 +00:00
William Bouchard
2f6edf367a feat(dashboard,cart,types,utils): refine order details summary (#13313)
* feat(dashboard,types,utils): refine order details summary

* fix tests

* changeset

* ui corrections

* tests again

* weird tests failing

* revert update to subtotal

* revert http tests too

* comments

* move credit lines so it makes more sense

* remove currency codes and add bold prices

* add new properties in default for storefront

* minor to patch

* remove bold on things that should be

* olis comment about taxes

* remove bold from shipping
2025-09-02 20:50:37 +02:00
Frane Polić
a28226af80 fix(core-flows): updating tax lines when draft order shipping is removed (#12919)
**What**
- don't call `updateOrderTaxLinesWorkflow` when a shipping method is removed from a draft order (tax lines will be cascade deleted with the method)
2025-07-14 13:35:44 +00:00
Frane Polić
9866baa852 feat(core-flows,js-sdk,medusa,types): draft order delete (#12172) 2025-05-28 14:37:00 +02:00
Frane Polić
c4dd290461 fix(core-flows): reservation management on order edit and draft order confirm (#12546) 2025-05-28 09:52:01 +02:00
Frane Polić
01542f6973 feat(core-flows, js-sdk, medusa): draft order shipping removal (#12124)
**What**
- allow removal of a shipping method

---

CLOSES CMRC-1013
2025-04-16 06:10:24 +00:00
Frane Polić
413a0da26c fix(core-flows): draft order reservations (#12115)
* fix: draft order reservations

* feat: add test case

* fix: assert item ids
2025-04-13 17:40:16 +02:00
Kasper Fabricius Kristensen
f441362f4a feat(medusa,core-flows,types,js-sdk): Draft Order workflows and API endpoints (#11805) 2025-04-02 10:23:33 +02:00
Kasper Fabricius Kristensen
3b4997840e fix(medusa,js-sdk,types): Add basic draft order operations to js-sdk (#11514)
**What**
- Exposes `sdk.admin.draftOrder.create/update/retrieve/list` functions from the js-sdk
- Implements the necessary types in the types package.
- Adds missing endpoints to admin API.
2025-02-20 16:05:21 +00:00