DavidAJohn / PhotoPortfolio

Personal photo portfolio .NET web application which implements a Blazor and Tailwind CSS user interface with a MongoDb database, and includes integration with Stripe Checkout and Prodigi Print API
0 stars 0 forks source link

Checkout page - delivery options #47

Closed DavidAJohn closed 1 year ago

DavidAJohn commented 1 year ago

When changing the delivery option on the Checkout page, a new quote is being sent and received but the price itself is not updating.

It may still be sending the default option of standard delivery each time.

DavidAJohn commented 1 year ago

After checking with the debugger, this doesn't seem to be a bug.

The Prodigi Print API is being sent different delivery options and a Sku such as "global-fap-16x24" (fine art print), returns different costs. However, with a Sku like "ECO-CAN-16X24" (eco canvas) it always returns £9.95.

Which is fine as long as that's intentional. There doesn't appear to be any way to find out which delivery methods are available for a product in a given country though.

DavidAJohn commented 1 year ago

It's possible to get quotes for each delivery method if you don't supply a specific delivery method in the request.

So I can confirm, this is intentional.

For the eco canvas, the only option for delivery in the UK is "DPD Local Next Day" at £9.95, regardless of which delivery option you request.

DavidAJohn commented 1 year ago

This creates an issue. It would clearly be confusing for a user if they were to choose different delivery options but the price doesn't appear to change on screen.

Realistically, if there is only one option we should disable the dropdown or not show it at all and just display the carrier and service as text.

How do we determine how many options there are? One option would be for the Checkout page to request a quote without specifying a shipping method, then comparing delivery prices (and methods?) to see if there are any variations.

This generates more traffic to Prodigi's API, but I'm not sure there are too many other ways. Could we check when adding a product on the admin - add product page? Delivery options could potentially change afterwards though.

DavidAJohn commented 1 year ago

So, at the moment the Checkout page makes a request for a new quote from the Prodigi Print API when the user chooses a different delivery option. The problem (as detailed above) is that some products only have one delivery option, although it is just repeated in the API response as standard, express and budget.

We could make a request without a delivery method when the page loads, then iterate through the delivery options returned in the quote, thus reducing the number of requests to Prodigi and allowing us to determine immediately whether to display delivery options to the user or to simply show the one option with the price.