Freeshipping condition macro

Wei Wang asked on September 3, 2020 17:56

Hi,

I need a macro that could allow to exclude items (like gift cards) from free shipping offer or calculation. I tried to add to the "Further conditions" under the "Free shipping conditions" section with something like (!ShoppingCart.ShoppingCartItems.Any(SKU.SKUGUID == xxxx) but that's not what I want. This macro will exclude from free shipping if any item (gift card) is in the order. But I want the free shipping still apply if the total is over $50 regardless they ordered gift card or not. But if they ONLY order gift card with total of $50+, then the free shipping won't apply. So how should I create the macro to achieve this?

Thanks Wei Wang

Recent Answers


Liam Goldfinch answered on September 3, 2020 21:56

Hi,

I think you might be better off creating a custom macro method and using that to carry out your logic. Kentico 12 documentation provides a good example using product categories, see here.

Use the macro you create on it's own in the Further conditions field, and leave the Minimum order amount field empty. You can then pass the name of the product category and order subtotal into the macro method like this:

Data.ContainsProductsInCategory("GiftCards", Subtotal)

You can loop over the basket items see if they have been assigned the gift card category, and also check the subtotal you've passed into the macro method as a parameter.

0 votesVote for this answer Mark as a Correct answer

Wei Wang answered on September 3, 2020 22:05

Thank you! I will try it out.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.