Shipping Director and error messages

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Some of our products are now restricted from being sold within certain states.
So I created a category of CA and put it on the items that are restricted.

Is it possible to reference to Item SKU in the Description Expression of SD?

I want to show a message of "Cart contains items restricted in CA SKU123

That way if cart contains multiple items, shopper will know what the offending SKU is.
4 years ago
Yes, you can reference variables in the Description Expression, just be sure the final result is a String.  E.g.

"Cart contains items restricted in CA  " + Items.First(Product.HasCategory("CA Restricted")).Product.Sku

This assumes your ErrorExit condition already checks :
  State = "CA" and Items.Any(Product.HasCategory("CA Restricted"))
(Otherwise you will get an error when trying to access '.Product' when there aren't any)

Note, it's only the first offending product.  Listing all offending SKUs is a little trickier.  (Let us know if you need to)

(P.S.  If you reference your own variables, be sure you bracket them  - eg.  [MyVar]  )
4 years ago
Works like a charm!  Thank you!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.