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

Fix Order#tax_address method #4429

Merged

Conversation

spaghetticode
Copy link
Member

Description

Calling #tax_address on an order that has no address but also no store associated raises the following error:

undefined method `default_cart_tax_location' for nil:NilClass

Given that the store association is optional, and/or it may not have been already set on the Spree::Order instance, we should avoid raising an error.

A simple way to expose the issue is by entering the following command in the rails console:

Spree::Order.new.tax_address

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change (if needed)

@spaghetticode spaghetticode added the type:bug Error, flaw or fault label Jun 16, 2022
@spaghetticode spaghetticode self-assigned this Jun 16, 2022
@waiting-for-dev
Copy link
Contributor

Hey @spaghetticode, if you rebase from master CI will be green 🪄 🙂

Calling `#tax_address` on an order that has no address but also no
store associates raises the following error:

    undefined method `default_cart_tax_location' for nil:NilClass

Given that the `store` association is optional, and/or it may not
have been already set on the `Spree::Order` instance, we should
avoid raising an error.

A simple way to expose the issue is by entering the following
command in the Rails console:

    Spree::Order.new.tax_address
@spaghetticode spaghetticode force-pushed the spaghetticode/fix-order-tax_address branch from 1cb99f6 to f7f85bf Compare June 22, 2022 07:00
@waiting-for-dev waiting-for-dev merged commit 5c0c355 into solidusio:master Jun 23, 2022
@waiting-for-dev waiting-for-dev deleted the spaghetticode/fix-order-tax_address branch June 23, 2022 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error, flaw or fault
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants