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

2.7 - Discount calculation classes #11889

Closed
wants to merge 24 commits into from

Conversation

mikejolley
Copy link
Member

@mikejolley mikejolley commented Sep 9, 2016

This is a WIP - do not merge. Raising PR to track progress for #4404.
#4404 is not possible with the current codebase, so I am refactoring our cart code to allow totals to be calculated from a dedicated class, to clean up the codebase, and to allow more unit tests.

WC_Cart_Totals will handle total calculation.

WC_Cart_Session handles session data.

WC_Cart is the controller and returns some data from subclasses and various totals.

WC_Cart_Coupons stores coupons.

WC_Cart_Items stores items.

WC_Cart_Fees stores fees.

I’m currently refactoring the newer WC_Order_item Classes so they can be used for cart items too since they are very similar.

TODO:

  • Update checkout to store details from the new classes
  • Refactor the order item classes and use for cart items.
  • Merge upstream.
  • Make orders share the same total calculation system
  • Apply backend coupon functionality
  • Unit tests for new classes.
  • Pass all tests.

@mikejolley mikejolley added this to the 2.7 milestone Sep 9, 2016
@mikejolley mikejolley added type: refactor The issue/PR is related to refactoring. UI labels Sep 9, 2016
@mikejolley mikejolley self-assigned this Sep 9, 2016
# Conflicts:
#	includes/abstracts/abstract-wc-data.php
#	includes/abstracts/abstract-wc-order.php
#	includes/class-wc-cart.php
#	includes/class-wc-coupon.php
#	includes/class-wc-customer.php
#	includes/class-wc-form-handler.php
#	includes/class-wc-order-item-product.php
#	includes/class-wc-order-item-tax.php
#	includes/class-wc-shipping-zone.php
#	includes/class-wc-shipping.php
#	includes/wc-cart-functions.php
@justinshreve
Copy link
Contributor

I'm closing this in favor of #12006. I did the rebase/merge in a new branch because of the amount of conflicts here and I wanted this as a starting point/reference incase I screwed up.

@claudiosanches claudiosanches deleted the discount-calculation-class-4404 branch November 18, 2016 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: refactor The issue/PR is related to refactoring.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants