I've set up TeaCommerce to apply free shipping on orders over xxx amount, by creating an order amount rule in the Marketing section. This works great and also allows me to differentiate the cutoff based on the selected currency like I wanted.
Now I want to display to the user what the cutoff point is for the selected currency ("Free shipping for orders over xxx"). How do I do this?
There is no API to fetch this information as the marketing system is really generic and have loads of possibilities. What you can do is properly to fetch the specific campaign using the CampaignService and then loop the rules and find your rule and the currency settings for it and use that to print on the webshop.
After alot of noodeling i figured this out. I'll post the code here for anyone else wanting to do this:
public decimal getCurrentFreeShippingLimit() {
// Get the campaign by name
IEnumerable<Campaign> campaigns = CampaignService.Instance.GetAllActive(storeId).Where(campaign => (campaign.Name == "Gratis fragt"));
Campaign freeShipping = campaigns.First();
// Get the first rule of the first group
OrderAmountRule rule = (OrderAmountRule)freeShipping.RulesGroups.First().Rules.First();
// Get the rule that corresponds to the current currency
Currency currency = TC.GetCurrentCurrency(storeId);
KeyValuePair<long, decimal> shippingAmonut = rule.Amounts.Where(amount => amount.Key == currency.Id).First();
// Output the value, ie. the free shipping cutoff point
return shippingAmonut.Value;
}
Getting free shipping rule values in basket
Hello!
I've set up TeaCommerce to apply free shipping on orders over xxx amount, by creating an order amount rule in the Marketing section. This works great and also allows me to differentiate the cutoff based on the selected currency like I wanted.
Now I want to display to the user what the cutoff point is for the selected currency ("Free shipping for orders over xxx"). How do I do this?
There is no API to fetch this information as the marketing system is really generic and have loads of possibilities. What you can do is properly to fetch the specific campaign using the CampaignService and then loop the rules and find your rule and the currency settings for it and use that to print on the webshop.
After alot of noodeling i figured this out. I'll post the code here for anyone else wanting to do this:
is working on a reply...