Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipping Options Service Missing, canCalculate is never called. #9598

Closed
amaster507 opened this issue Oct 16, 2024 · 16 comments
Closed

Shipping Options Service Missing, canCalculate is never called. #9598

amaster507 opened this issue Oct 16, 2024 · 16 comments

Comments

@amaster507
Copy link

Bug report

Describe the bug

The shipping-options service seems to be missing

System information

Medusa version (including plugins):
Node.js version: 20
Database: postgres
Operating system: linux host with docker containers running node/postgres/redis/etc.
Browser (if relevant): Chrome/NA

Steps to reproduce the behavior

  1. Implement a class extending the AbstractFulfillmentProviderService with the canCalculate and other methods.
  2. Update medusa-config.js to use the custom fulfillment provider service.
  3. Update the admin to use the custom fulfillment provider service and create shipping options using a calculated price.

Expected behavior

The custom fulfullment canCalculate should be called when listing shipping options for a calculated options.

Screenshots

See Discussion linked below

Code snippets

#9495

Additional context

From looking at the 1.x repo, the canCalculate method is called withing the packages > medusa > src > services > shipping-options.ts And this gets called from validatePriceType_ which gets called from validateAndMutatePrice, etc. None of these seem to exist anymore in the v2 repo. Obviously there was a refactor, and I believe these were not added back in after the refactor.

@olivermrbl
Copy link
Contributor

olivermrbl commented Oct 16, 2024

You are right, we haven't added backend support for calculated prices on shipping options yet. This is something we will look into in the coming days or right after the official release :)

@amaster507
Copy link
Author

assuming this will be post 2.0 release? Is there any indication in the docs what other features like this may not yet be fully developed. The 2.0 docs lead me to believe that a fulfillment service would be functional if I developed it correctly and added it to the configuration. Just want to know what else is lacking in the official 2.0 release.

@ikok07
Copy link

ikok07 commented Oct 26, 2024

You are right, we haven't added backend support for calculated prices on shipping options yet. This is something we will look into in the coming days or right after the official release :)

I want to use Medusa for my next project but I really need this feature. Will it be available in the next couple of days?

@victormamede
Copy link

I also noticed that the medusa sdk throws an error if there's no price for a shipping option, even if that price is calculated.

@Reomar
Copy link

Reomar commented Dec 2, 2024

Is this bug fixed ?!

@amaster507
Copy link
Author

Not that I am aware of. I've postponed trying to get it to work until some official word about the status of plugin modules like this and their future. If they plan on supporting the existing APIs or if there is some other model that should be followed instead.

@amaster507
Copy link
Author

@olivermrbl any updates? It's been a few days since 2.0 release...

@amaster507
Copy link
Author

amaster507 commented Dec 4, 2024

is this addressed at all with the latest releast https://github.com/medusajs/medusa/tree/v2.1.0? I would like official feedback before I wast time on trying to see if this works now or not. Maybe with the commit #10432 ??

@amaster507 amaster507 changed the title Shipping Options Service Missing, canCalculate never is called. Shipping Options Service Missing, canCalculate is never called. Dec 4, 2024
@amaster507
Copy link
Author

@olivermrbl was this resolved in the 2.1.1 release??

Shipping option rules

We've introduced support for pricing rules on shipping options. Initially, the feature allows you to define prices based on the cart item total. For example, you could have a free shipping option that is only available when the item total is above 100 EUR.
Every time the cart is updated, e.g. with new items, we refresh the shipping methods to ensure the correct price is applied at all times.
You'll find the new setting in the admin dashboard under "Settings > Locations & Shipping > View details > Edit prices (on shipping option)".

@olivermrbl
Copy link
Contributor

@amaster507, this is part of the next release, likely shipping later this week. My apologies for not following up.

@Saman67
Copy link

Saman67 commented Dec 17, 2024

@olivermrbl - Can you give us update about this issue? Thanks

@Reomar
Copy link

Reomar commented Dec 24, 2024

I think it's fixed in v2.1.3, is that right?

@shahednasser
Copy link
Member

Hey guys, this issue is fixed in the latest release. Will close this issue now.

@blbergo
Copy link

blbergo commented Jan 3, 2025

I'm having a similar problem to this in v2.1.3, where validateOption appears to not be called when creating a calculated shipping option from the UI. For context, I'm building a custom shipping integration with Shippo, and they require creating a service zone before requesting live rates at checkout, and so it would make sense to create this zone once the option is created by an admin user.

@blbergo
Copy link

blbergo commented Jan 4, 2025

I am now having the same issue with validateFulfilmentData - for anyone looking for a workaround, try overriding the default API routes for /shipping-option/your-desired-route to intercept requests

@shahednasser
Copy link
Member

Hey @bibergo I would advise you to update to the latest version, and if it's still not working then please open a new issue with all your setup's details so that we can provide better support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants