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 everybody. I want to implement a kind of an extra fee when a certain combination of shipment/paym

UPWG9AYH2
UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi everybody. I want to implement a kind of an extra fee when a certain combination of shipment/payment was chosen in checkout process. Just in the checkout step its possible to know about this expenses because you just know here what shipment is selected (via checkout-data endpoint). For this, I tried to investigate the shipment feature for this and how the prices there gets calculated, but i can’t figure out, where the final calculation for totals are made. So there are no final prices when a shipment method is provided. Just the methods with single prices are returning. How to get the complete prices on checkout? πŸ€” Some other ideas to show an extra fee when a certain combination of shipment/payment method was chosen? Thanks!

Comments

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    you need to implement calculator plugin https://documentation.spryker.com/docs/calculator-plugins

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    and then apply your logic there

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yes, thats obvious. It’s more the workflow … where to add what shipment was chosen and then where to calculate the stack again? On checkout-data endpoint? On update cart endpoint? The last one does not accept any shipment information … seems a lot of work do get them so. I am a bit wondering that this is nowhere considered …

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    you need to call the calculation client recalculate when you have created the plugin

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    so you add to quote things you need to determine the additional costs based on user input -> call the calculation client -> do the calculation in the plugin

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

    Okay, i try to explain it the other way around … on which glue endpoint(s) can (or should) i set the used shipment method for the current cart? When the shipment method was set in the current quote, i am pretty sure that the calculation gets done correctly when i fetch the current cart again. But for now it seems that no endpoint is capable of setting the correct shipment method so that its persisted in the cart (201907.0)

  • Eugenia Poidenko
    Eugenia Poidenko Sprykee Posts: 145 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hi Ingo! You are correct assuming that the shipment data is not persisted in the Quote. And since Glue uses the persisted quote, it is at no point aware of the selected shipping methods.

    Nevertheless if the shipping method is sent to the /checkout it will get applied and if the expense depends on that, it will show up.

    No way currently to see the cart with expense applied though.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    edited February 2020

    Good morning @UPWG9AYH2! Can I close support ticket?

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hi Eugenia. Thanks for your comment. I was just wondering since this is in my eyes something the most people using glue should stumble over. Is there any experience how they handle this? What do they show to their costumer? So for now I found a little β€œworkaround” … in checkout-data i make an extra call to the calculation facade (like in the final checkout endpoint) and do a recalculate of the current quotetransfer (which has a shipment method in it in that moment) … that will persist at least the expense for shipping once. The drawback is, that when you add some items via item add endpoint, the expense calculation disappears. Since checkout and and product search/catalog are separate sections anyway at the moment, we could maybe live with that … but it still remains not really a good solution …

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

    @valerii.trots just this question also to you, maybe we can do something other

    Is there any experience how they handle this? What do they show to their costumer?

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    I was going to send a link to our SPA demo instance - http://glue.91.spa.demo-spryker.com/react. But it seems that it's kind of broken as you can't go further than payment selection step. But the shipment expenses are reflected through checkout.

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

    Now the big question: Does the frontend sum up the grand total by itself?

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

    Would really like like to see the request/responses from console here, but as you said, it doesnt work

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Seems like it's done on the FE side, I don't see any requests after the shipment method is selected.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Yes, confirmed by the developer of this SPA. It's done on the FE side completely.

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thanks a lot, then we will do this also that way πŸ˜‰ I think, the ticket can be closed

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 πŸ§‘πŸ»β€πŸš€ - Cadet

    The glue demo frontend works now πŸ˜„ … seems i forgot to choose a country but it wasn’t marked as missing

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Yes, the button is grey until you select the country at the address step. But it's marked as required with *. πŸ˜„