What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi all, is there an easy way to get the shipment costs of an order? (Net, Gross, Taxes)

U01660GHSTT
U01660GHSTT Posts: 80 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi all,
is there an easy way to get the shipment costs of an order? (Net, Gross, Taxes)

Comments

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    if you pull order from sales facade it should come with hsipment information (which is deprecated) and every item from said order should have shipment information set (shipment per item is the new way), don't know if this is the easy solution you are looking for

  • U01660GHSTT
    U01660GHSTT Posts: 80 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thanks for your answer. That looks really complicated. To get the shipment costs (net, gross and taxes) I need to iterate over the items, get the shipments, it's method and then the prices. Then I can get a net amount and a gross amount and thus can calculate the taxes and then I need to add those values up for all items.

    I thought there would maybe exist something like this:
    $orderTransfer->getShipment()->getNetPrice(), $orderTransfer->getShipment()->getGrossPrice() and $orderTransfer->getShipment()->getTaxAmount().

    I don't really understand the concept(s) behind all this and the documentation doesn't really help.

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    well, me neither

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    but as I mentioned before, if you get OrderTransfer from SalesFacade, it will have getShimpmentMehods method, which should return list with a single element, if you have multi shipment disabled (and it seems you do)

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    but this method is deprecated, so use it with caution as it may disappear or start throwing exceptions at some point

  • U01660GHSTT
    U01660GHSTT Posts: 80 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thanks a lot. I will try to solve it somehow with this new information.

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    It would be really nice to know the benefit of migrating shipping information on item level. If there are a lot of items in the cart, the json is explodes with duplicated shipping transfers.