Problem/Motivation

Shipments can have additonal addon surcharges or services such as insurance, signature required, hazardous materials. Currently every shipping module must provide it's own implementation. This isn't a problem if you can roll the surcharge into the shipping service price. If you want user choice for addon shipping services you have to implement your own UI.

Use Cases

commerce_usps gets a quote for insurance and signature confirmation from the USPS API when requesting a rate quote. It includes these quotes as options on the shipping method

commerce_fedex has a surcharge for hazardous materials. The fedex module could display this surcharge with the shipping method instead of invisibly adding it the shipping method price

A freight module has optional addon services such as lift gate, packaging, etc which are displayed as options for the user to select from

Proposed resolution

Create an API that allows shipping service modules to define shipping price adjustments.

Each adjustment consists of three values: Label, Price, Optional

User interface changes

The label and price are displayed in the shipping pane next to each of the available shipping methods
If an adjustment is optional it is displayed below the selected shipping method. If a shipping method is selected by a user that has an optional adjustment then display a checkbox, the label, and the +price below the shipping method

example

CommentFileSizeAuthor
#4 Screenshot from 2021-04-02 15-53-51.png32.76 KBrhovland

Comments

andyg5000 created an issue. See original summary.

rhovland’s picture

rszrama:

In Commerce 1.x, we kind of supported this through form fields similar to the payment method form fields included in the payment pane when a payment method was selected. However, the proposal is a bit more robust when it suggests we should accommodate specialty flags at the Shipment level. I tend to agree - providing an abstract interface for these items should make it easier for downstream modules to support while allowing Commerce Shipping itself to control the UX.

I can see this similarly being useful for freight shipments, differentiating between residential vs. commercial addresses and / or permitting customers to opt-in to liftgate service, indoor delivery, etc.

rhovland’s picture

Issue summary: View changes
rhovland’s picture

Issue summary: View changes
StatusFileSize
new32.76 KB
jsacksick’s picture

I've been thinking about this lately, and I'm pretty sure we need shipment processors... And a ShipmentRefresh service (that is similar to OrderRefresh).

We need a refresh process for shipments... So that is part 1, and we probably need to allow shipping rates to have adjustments as well...

So if a rate is selected and has adjustment.

ShippingMethod::applyRate() should transfer adjustments to the shipment.