verbb / postie

A Craft Commerce shipping calculator plugin.
Other
12 stars 18 forks source link

Can't add shipping methods with $0.00 rate through a custom provider #16

Closed keyurshah closed 4 years ago

keyurshah commented 4 years ago

Description

I'm trying to add a custom shipping method through a custom provider.

I need to set some of the options with $0 rates (free, pickup in store, etc..), but when I do so, it does not allow me to add it.

It seems the issue is this line

https://github.com/verbb/postie/blob/49f48d61c9b861ad111f87402a1f6d2868f6d888/src/models/ShippingMethod.php#L61-L64

it seems the check (bool)$this->rate will remove anything with 0 or 0.0 amount

it seems to work if I change it to

return (bool)$this->enabled && isset($this->rate)

I can create a pull request if this would not cause issues to anything else. Thanks!

Steps to reproduce

  1. add a custom provider
  2. set amount to 0 for the shipping method
engram-design commented 4 years ago

Yeah, not sure what I was thinking here. Fixed in 2.1.0.