James
James

Reputation: 12806

How to make a discount apply to only one shipping method in Commerce Server 2007?

I searched and searched for an answer for this seemingly simple question in Commerce Server 2007, but have found nothing useful. This seems like something that should be possible. How to make a discount apply to only one shipping method in Commerce Server 2007?

Upvotes: 1

Views: 664

Answers (3)

bentayloruk
bentayloruk

Reputation: 4101

Steve and Erwin are correct. There is not an out of the box solution for this, but you can try and work around it using custom pipeline components or scriptor components.

There is a commercial alternative. Enticify is a, drop-in replacement for the Commerce Server discount pipeline components, that does support shipping method specific discounts (amongst other things).

Disclaimer: I am an Enticify employee.

Enticify adds the concept of Shipment Expressions. You use these like you do Eligibility Expressions (you actually set them in the Marketing Manager Eligibility tab). However, you can make a discount shipping method specific by targeting properties like shipping_method_id.

Here you see the shipment expression targeting the shipping_method_id (but you could target other shipment properties):

Enticify Shipment Expression targeting the shipping method id

And here you see it listed in the eligibility expressions dialog:

enter image description here

When run, this discount will only apply to shipments that meet this expression. You can read more in the Enticify Shipping Discounts documentation. This is quite powerful, as it can be used to qualify product discounts too (e.g. get a discount on product X when you choose next day shipping).

Upvotes: 0

Steve Temple
Steve Temple

Reputation: 2278

I've run into this problem before, I had a scenario where the standard delivery option was the only one that would ever be discounted and the next day and international options would always be full price.

In this instance I wrote a custom pipeline component which removed any shipping discounts if any other shipping method other than the standard was selected.

I added this scriptor component into the total pipeline below the ShippingDiscountAdjust component, it's a bit of a hack as I've hardcoded the standard deliveries id in, but that won't ever change so I could get away with it:

    function MSCSExecute(config, orderform, context, flags)

        Dim shipments        ' SimpleList of shipments in the basket
        Dim shipment        ' An shipment dictionary from the list
        Dim sShipmentID

        ' Save shipping discounts for each shipment (as written by ShippingDiscountAdjust)
        If not isNull(orderForm.Value("shipments")) then
            Set shipments = orderForm.Value("shipments")    
            For Each shipment in shipments            
               sShipmentID = shipment("shipping_method_id")
            Next

            if sShipmentID <> "{00000000-0000-0000-0000-005719007655}" and orderForm.value("_cy_shipping_discounts_total") > 0 then
                orderform.value("_shipping_discount_description") = ""

                For Each shipment in shipments            
                     orderForm.value("_cy_shipping_total") =orderForm.value("_cy_shipping_total")  + shipment.value("_cy_shipping_discounts_subtotal")
                     shipment.value("_cy_shipping_discounts_subtotal") = 0
                Next

                orderForm.value("_cy_shipping_discounts_total") = 0
            end if
        End If

        MSCSExecute = 1
    end function

    sub MSCSOpen(config)

    end sub


    sub MSCSClose()

    end sub

Upvotes: 2

Erwin
Erwin

Reputation: 121

If you want a discount to be only applicable if the user selected a certain shipping method, then this is not possible out-of-the-box.

You can always write a custom pipeline component, but dealing with the discounts in the pipeline could be complicated.

Upvotes: 2

Related Questions