Magento – Bulk Coupons and URL rewrites

Photo of author
Written By Ryan Rana





I did the development work for the 2012 Queens Diamond Jubilee site, a Magento and WordPress combination for Igniyte in Leeds (as I write I’m planning to do a case study about it, I’ll make a note to come back and link to it here when I’m done). The site has been live for 5 months now and it’s been really successful, shipping a lot of products globally and generally performing really well.

Well enough that the mighty Vodafone decided to do a tie in with the site and offer a selection of products to their customers free. They needed: Free product cost and free delivery on one list of products. I needed to generate coupons in bulk, set shopping cart promotional rules, set up the config so that the customers could continue shopping and add other (paid for) products to the basket, and configure zero sum checkout and free shipping.

As always with Magento there are a million different ways to configure the system and the config you want isn’t one of them! I can’t go into details, but the gist of how to set it up is as follows ->

For a start you need to modify the files;


To ensure that your free shipping and payment methods will display on their own if they are applicable, and not display at all if there are paid for products in the cart.

Bulk coupons – the following module was absolutely excellent -> Bulk Coupons. Amasty are one of those Magento module providers who I’ve seen loads but never used. I’d recommend them from what I’ve seen here, it’s an excellent module, well written with good documentation and it works perfectly. I created a new category of products (not shown in the navigation) and then added the individual products before applying a shopping cart coupon to each of those.

Note, Magento gotcha – individual SKUs cannot have Promo Rule Conditions set on them be default, you have to enable that in Catalog -> Attributes -> Manage Attributes , setting the ‘Use for Promo Rule Conditions’ to YES for the ‘SKU’ attribute.

Each coupon is then used as a template, you use the Amasty module to generate the same coupon with the same actions and conditions en masse based on a numbers/letters format random key generator.

Better still, this module has a great coupon usage report and also allows you to apply the coupons as a URL suffix, meaning that they could be send out to individuals on a one use/on customer basis. Unfortunately the SEO friendly URLs and deep nested categories meant that the URLs were far to big to be sent by Vodafone as an SMS. Enter Magento’s built in URL rewrite functionality.

Normally you’d have to set up rules in the .htaccess for custom rewrites but Magento has an often overlooked system in Catalog -> URL Rewrite Management that allows you to set up custom URL rewrites within the system. There is also a commercial module that allows bulk import and export so (although it wasn’t needed in this circumstance) you could export the generated coupons, rework it in Excel or Open Office Calc and reimport via the URL rewrites and hey presto – shortened URLs with the coupons appended which could be used as links that automatically applied the coupon codes.

Leave a Comment