Skip to content

Instantly share code, notes, and snippets.

@hongc-cc
Created September 28, 2016 05:10
Show Gist options
  • Save hongc-cc/9da1b030a7313312f1a2f67689ecb4c3 to your computer and use it in GitHub Desktop.
Save hongc-cc/9da1b030a7313312f1a2f67689ecb4c3 to your computer and use it in GitHub Desktop.
[CraftCMS] Comparing the cart products to the discount coupon applied.
// collect productIds in the cart
{% set currentDiscount = craft.commerce.getDiscountByCode(order.couponCode) %}
{% if currentDiscount %}
{% if not cartProductIds in currentDiscount.productIds %}You have no products in the cart that meet this discount{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment