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

Marketplace: Collect Taxes for Products with a TaxRate on Checkout #1200

Merged
merged 2 commits into from
Mar 10, 2023

Conversation

zspencer
Copy link
Member

@zspencer zspencer commented Mar 9, 2023

Whoooo! TaxRate gets calculated! And collected!

tax-rates-demo.mp4

@zspencer zspencer force-pushed the marketplace/collect-taxes branch 2 times, most recently from 3113dfc to 5e7c58b Compare March 9, 2023 02:33
@zspencer zspencer added the ✨ feature Reduces Client's Burden or Grants them Benefits label Mar 9, 2023
@zspencer zspencer changed the title Marketplace: Collect Taxes for Products with a TaxRate on Checkout Marketplace: Collect Taxes for Products with a TaxRate on Checkout Mar 9, 2023
@zspencer zspencer requested review from anaulin, daltonrpruitt, KellyAH and a team March 9, 2023 03:11
Copy link
Member

@anaulin anaulin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

def tax_total
cart_products.sum(0) do |cart_product|
cart_product.tax_amount
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just cart_products.sum(&:tax_amount) ?


validates_uniqueness_of :product, scope: :cart_id
validate :editable_cart

attribute :quantity, :integer, default: 0

def tax_amount
price_total * (tax_rates.sum(0) do |tax_rate|
tax_rate.tax_rate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, I think this can be price_total * (tax_rates.sum(&:tax_rate) / 100)

zspencer and others added 2 commits March 9, 2023 18:01
…kout`

- #1137

Whoooo! `TaxRate` gets calculated! And collected!

Co-authored-by: Ana Ulin <anaulin@users.noreply.github.com>
Co-authored-by: Dalton Pruitt <daltonrpruitt@users.noreply.github.com>
Co-authored-by: Kelly Hong <KellyAH@users.noreply.github.com>
@zspencer zspencer force-pushed the marketplace/collect-taxes branch from 5e7c58b to 1cc1052 Compare March 10, 2023 02:05
@zspencer zspencer merged commit 33058d2 into main Mar 10, 2023
@zspencer zspencer deleted the marketplace/collect-taxes branch March 10, 2023 02:19
@zspencer zspencer added this to the 1.0 - Andromeda milestone May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature Reduces Client's Burden or Grants them Benefits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants