Problem/Motivation

ShipmentWeight was recently expanded to provide a Max Weight + two new Operations in #2919113: Expand the ShipmentWeight condition to support ranges:

>= <= : Between (exclusive) and > < : Between (inclusive)

These do not however allow the admin to provide sequential weight shipping options without experiencing multiple shipping methods (or none) being provided to the user.

eg. 3x ShipmentWeight condition ship methods:

  • 0 - 2kg inclusive: $5
  • 2 - 4kg inclusive: $8
  • 4 - 8kg inclusive: $12

To work with the existing setup, the numbers entered have to be Weight: 0kg, Max Weight: 1.9999999999kg instead of a simple Max Weight: <2kg

Switching to exclusive obviously ends up with NO shipping methods available for 2 and 4kg.

Steps to reproduce

  • Install Commerce + Shipping, add products, variations, etc
  • Add 3 shipping weight based methods as specified above.
  • Add products to the cart such that EXACTLY 2 or 4kg is the final weight.
  • 2x shipping methods provided with a significant price difference.

Proposed resolution

Add operations:

  • >= < : Between (>= Weight, < Max)
  • > <= : Between (> Weight, <= Max)

Remaining tasks

None.

User interface changes

Adds 2x Operations in ShipmentWeight condition select field.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

elc created an issue. See original summary.

elc’s picture

Assigned: elc » Unassigned
Status: Active » Needs review

Appears tests are running against Commerce 3 and that is not currently passing tests.

This patch is working in a production site to reproduce the behaviour from the patches before the final result was merged in.

elc’s picture

Title: ShipmentWeight operations should provide left/right anchor option » ShipmentWeight operations should include "or equal" options

Upstream tests have been fixed, so tests now pass.

jsacksick made their first commit to this issue’s fork.

jsacksick’s picture

Status: Needs review » Fixed

Looks good to me, committed! Thank you!

  • jsacksick committed 11b4f468 on 8.x-2.x authored by elc
    Issue #3490977 by elc: ShipmentWeight operations should include "or...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.