Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs update: shipping/billing address #91

Closed
ryanmitchell opened this issue Jan 26, 2022 · 6 comments
Closed

Docs update: shipping/billing address #91

ryanmitchell opened this issue Jan 26, 2022 · 6 comments

Comments

@ryanmitchell
Copy link
Contributor

On: https://docs.getcandy.io/getcandy/carts.html#adding-shipping-billing-address

The shipping address formats are wrong:

[
    'line_one' => null,
    'line_two' => null,
    'line_three' => null,
    'city' => null,
    'state' => null,
    'postcode' => null,
    'country' => null,
]

should be:

[
    'first_name' => null,
    'last_name' => null,
    'line_one' => null,
    'line_two' => null,
    'line_three' => null,
    'city' => null,
    'state' => null,
    'postcode' => null,
    'country_id' => null,
]

Also the validation error here: https://github.com/getcandy/getcandy/blob/86d39477af3b4de1feaf9653ff94c912cb4a5625/packages/core/src/Actions/Carts/ValidateCartForOrder.php#L63

Should really pass the errors back so they can be output?

@NaincyKumariKnoldus
Copy link
Contributor

Hey @ryanmitchell I have raised a PR for this. Please review my PR!

@glennjacobs
Copy link
Contributor

Thank you @ryanmitchell and @NaincyKumariKnoldus, we'll take a look soon.

@alecritson
Copy link
Collaborator

Hi @ryanmitchell We imagined that the storefront would have their own validation in place for this. When the exception is thrown it's almost a last line of defence to the address being incomplete.

@ryanmitchell
Copy link
Contributor Author

@alecritson thats grand, and I would be planning on validating there, but is there any harm in passing them back when they are available ($shippingValidator->errors()) ?

@glennjacobs
Copy link
Contributor

I would say the harm is people may start to use them rather than implementing their own validation, which I would consider a risk. We want to encourage the application developer to implement their own validation.

@ryanmitchell
Copy link
Contributor Author

Thats grand, I'll close this off as its not relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants