Last active
January 31, 2018 21:21
-
-
Save exit99/fa99d93eb2a6a9aecd0a5a9b2ac2285c to your computer and use it in GitHub Desktop.
How we would adjust pricing on store via a tag on the managed-services+ option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the code in core that adjusts option pricing for discounts | |
@return_decimal | |
def get_discount(self, option_price, discount_id): | |
from core.api.store.carts.models import CartDiscount | |
discount = CartDiscount.query.get(discount_id) | |
return discount.calculate(option_price) if discount else 0 | |
# This would be new code that adjust the price for the order. | |
@return_decimal | |
def get_discount(self, option_price, discount_id): | |
from core.api.store.carts.models import CartDiscount | |
discount = CartDiscount.query.get(discount_id) | |
discount = discount.calculate(option_price) if discount else 0 | |
if ('manages-services+' in self.tags and option is 'managed-services': | |
discount = discount - 29 | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the current logic for rendering the price | |
makePrice: -> | |
price = @props.option.total_price @props.selectedOptions.licenses_needed | |
setup = @props.option.setup | |
<span className="price"> | |
{price} | |
</span> | |
// This would update the logic to adjust the price based on the managed-service+ tag | |
makePrice: -> | |
price = @props.option.total_price @props.selectedOptions.licenses_needed | |
setup = @props.option.setup | |
// Subtract 29 from the price if they have managed services selected on rapid restore. | |
if ('managed-service+' in tags and option has tag 'rapid restore') { | |
price = price - 29 | |
} | |
<span className="price"> | |
{if price or setup then "("}{if price then "$" + price + (if @props.option.is_ssl then "/annually" else "/mo.")}{if price and setup then " & "}{if setup then "$" + setup + " Setup Fee"}{if price or setup then ")"} | |
</span> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment