Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from FosterCommerce/feature/shipping-rate-event…
Browse files Browse the repository at this point in the history
…-errors

Docs for “Add the ability to return an error in ShippingRateEvent”
  • Loading branch information
benface committed Jul 10, 2021
2 parents c818bde + eeea4c3 commit 0553dd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/dev/events.md
Expand Up @@ -14,15 +14,15 @@ Once you've configured Snipcart to post to your webhook URL, each of the followi

Receives [ShippingRateEvent](https://github.com/workingconcept/snipcart-craft-plugin/blob/master/src/events/ShippingRateEvent.php) with `order` and `package` properties.

Triggered in response to a `shippingrates.fetch` webhook event, but _before_ shipping rates are requested from a shipping provider. This offers a chance to modify the order before shipping rates are requested.
Triggered in response to a `shippingrates.fetch` webhook event, but _before_ shipping rates are requested from a shipping provider. This offers a chance to modify the order before shipping rates are requested, or do some validation and throw an error by setting the event's `isValid` property to `false` and optionally setting the `errors` property to an array of `['key' => 'error key', 'message' => 'error message']` associative arrays.

## Shipping Rate Response

`Shipments::EVENT_BEFORE_RETURN_SHIPPING_RATES`

Receives [ShippingRateEvent](https://github.com/workingconcept/snipcart-craft-plugin/blob/master/src/events/ShippingRateEvent.php) with `order`, `package` and `rates` properties.

Triggered before any custom shipping rates are returned to Snipcart so that they may be filtered or modified.
Triggered before any custom shipping rates are returned to Snipcart so that they may be filtered or modified. You can also do validation and throw an error (for instance if no `rates` were returned) by setting the event's `isValid` property to `false` and optionally setting the `errors` property to an array of `['key' => 'error key', 'message' => 'error message']` associative arrays.

## Completed Order

Expand Down

0 comments on commit 0553dd9

Please sign in to comment.