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 Calculators still calculate for cancelled items #1837

Open
ericsaupe opened this issue Apr 10, 2017 · 7 comments
Open

Shipping Calculators still calculate for cancelled items #1837

ericsaupe opened this issue Apr 10, 2017 · 7 comments
Labels
confirmed Validated report type:bug Error, flaw or fault

Comments

@ericsaupe
Copy link
Contributor

Steps to reproduce

  1. Complete order with many items and flexirate shipping calculator
  2. Cancel items in shipment
  3. Adjustment created does not take into account shipping cost
  4. Cost on shipping was not changed even though less items will be shipped

Expected behavior

After an item is cancelled the calculator should only calculate cost based on what is actually going to ship.

Actual behavior

Shipping calculators are calculating cost on all items even if they are cancelled:

System configuration

Solidus Version: 2.1 (seems to be in all)

Extensions in use: core, frontend, backend

@mamhoff mamhoff added the type:bug Error, flaw or fault label Apr 22, 2017
@jacobherrington
Copy link
Contributor

This is still present in Solidus 2.7.

@kennyadsl
Copy link
Member

@ericsaupe should be closed with #3059, can you please check?

@ericsaupe
Copy link
Contributor Author

It still seems to be a little bit off. Maybe it's just the taxes? Anyway so the setup here is

Shipping Rate Calculator - Flexible Rate by item with first item $1.5 and addition items $1

  • Added three different products to the cart
  • Completed checkout
  • Canceled two of the three items
  • The adjustments created did include the additional $1 for shipping but the shipping cost, which is taxed, remained the same. Also the tax adjustments were readjusted and now show a negative adjustment of a few cents. The tax adjustment for the remaining item seems to have disappeared as well.

screen shot 2019-02-05 at 2 56 26 pm

This was done against the current 2.9.0.alpha

Correct me if I'm misunderstanding it all here but I think it should adjust the cost of shipping by the canceled item change, adjust the line item by the cost of the item, and maybe additional adjustments to remove taxes? Just thinking about it from an accounting standpoint where adjustments were created to charge money from a customer and then negative adjustments were created to restore money to the customer against what they paid for.

@mdesantis
Copy link
Contributor

mdesantis commented Feb 7, 2019

@kennyadsl, #3059 isn't related to this issue, since it doesn't mess with shipment adjustments.

I worked recently on Spree::UnitCancel and I can't remember any attempt there to create adjustment for shipment costs, so I suspect to be that way by design. If instead we all agree that when we go on 'Cancel Items' tab and we cancel line items the related shipment costs should be adjusted accordingly, we should work on that as it is a "feature", from a developer point of view

@mdesantis
Copy link
Contributor

@ericsaupe, by my checks, cancelling items doesn't take in consideration shipment costs using any shipment method: does it match with your observations?

@cesartalves
Copy link
Contributor

Since @jacobherrington has said it was still present on 2.7, I verified how the code was since that version and it seems it hasn't changed much in regards to the described method.
https://github.com/solidusio/solidus/blob/v2.7/core/app/models/spree/calculator/shipping/flexi_rate.rb

My guess would be that the problem still lingers since no code was changed, but I will need to attempt to reproduce.

A solution would be to add a new shipped_contents to the Calculators, however this involves package building (specifically build_package on the splitter and Stock::Package class) so I will need to try and reproduce the problem on supported versions.

@cesartalves cesartalves added the confirmed Validated report label Nov 23, 2022
@seand7565
Copy link
Contributor

seand7565 commented Sep 23, 2023

Can confirm this is still an issue. To reproduce (on the demo store if you have no vanilla environment):

  1. Update one of the shipping methods to Flexible Rate Per Package Item (I set first item to $1 and consecutive items to $2)
    image
  2. Create a new order and add 3 items
  3. Add a random taxable NA address, ensure the flexible shipping method is picked, pay for the order via check and complete it. Shipping should be $5 if using the configuration above ($1 for first item, $2 for each of the next two items, for $5 total)
  4. Cancel two of the items on the order after completion using the "Cancel Items" tab.
  5. Refresh. Shipping is still $5, when it should be $1, as only one item is actually shipping.
    image

Usually you'd want to avoid recalculating orders post-completion, but this situation kind of demands it. I think a simple solve - assuming this doesn't introduce other issues - could be to toss an order.recalculate in the cancellations_controller after this line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed Validated report type:bug Error, flaw or fault
Projects
None yet
Development

No branches or pull requests

7 participants