Payment Director - If certain product is in cart, then only allow COD payment method

In this Payment Director example, we only want to allow COD if the cart contains an IPod.

Set up a variable to calculate the condition, and then suppress all options except COD if the condition is not met.  For example, let’s say that you generally offer two payment methods – COD, and Credit Card (e.g. Authorize.net).  However, if the cart contains an IPod, then you only want to offer COD:

Order

Type

Name

Expression

Fee Expression

Friendly Name Expression

10

Boolean

Only_COD_Allowed

Items.Any( Product.HasCategory("IPods") )

 

20

Option

Payments.CashOnDelivery

Show

 

30

Option

Payments.AuthorizeNet

![Only_COD_Allowed]

 

(The “!” is the NOT operator)

Above we use a Category to distinguish IPod products.  But, you can do it any number of ways…

Product SKU(s)

                Items.Any( Product.Sku  = "12345" or Product.Sku  = "56789"  )

                Items.Any( "12345, 56789, 55555".Contains(Product.Sku) )

Product Name

                Items.Any( Product.Name.StartsWith("iPod nano") )



----------------------------------------------------------------------------------------------------------------------------------------------------------------

Here's the same for older versions of nopCommerce having Product Variants:

Order

Type

Name

Expression

Fee Expression

Friendly Name Expression

10

Boolean

Only_COD_Allowed

Items.Any( ProductVariant.Product.HasCategory("IPods") )

 

20

Option

Payments.CashOnDelivery

Show

 

30

Option

Payments.AuthorizeNet

![Only_COD_Allowed]

 

(The “!” is the NOT operator)

Above we use a Category to distinguish IPod products.  But, you can do it any number of ways…

Product SKU(s)

                Items.Any( ProductVariant.Sku  = "12345" or ProductVariant.Sku  = "56789"  )

                Items.Any( "12345, 56789, 55555".Contains(ProductVariant.Sku) )

Product Name

                Items.Any( ProductVariant.Product.Name.StartsWith("iPod nano") )

Tags :  PD-Restrict
Comments
Leave your comment
:
office@liferevs.com
Created on: 6/15/2014 5:29 PM
This is what I was looking for, will install trial now.