Has anyone set up a 'by - category' type shipping plugin in exp:resso store?

I want to allow the client to use the category list to manage their own categories for products, but at the same time put in a flat rate for shipping per category.

For example, if a category falls under the category of books, the shipping is $4. If it is something small like seeds, shipping is $1, etc etc. If they pick one of each, the larger is taken as the final shipping price.

I am looking at the: per_item_rate, per_weight_rate fields in the store tables and I am thinking of adding a: per_category_rate table, but don't want to modify core stuff, only extending what is there for easy upgrades.

So taking the default shipping plugin - would it be best to start from this and build upon it, making change to the database fields and logic within it?

Or, would it be better to pull from a category group, and use a custom shipping field for the category, and roll your own plugin for shipping this way?

Any points in the right direction will ensure I don't go too far down one route when another is the best practice or more flexible way of going about it.

1 Answer 1


There is nothing like this built in, so you would need to create a shipping plugin from scratch.

If you just need a one-off, and don't mind hard coding the values, you would be best to take a look at this simple example shipping plugin for Expresso Store.

If you want to create a redistributable plugin with a nice interface etc, take a look at the default shipping plugin (which is significantly more complex than any of the other shipping plugins). You probably want to avoid creating extra database tables etc, so you can store the settings for your plugin as an array (this will get automatically serialized/unserialized when your plugin is loaded).

If creating a reusable plugin, I would either create an interface to select categories and assign prices to them, or use a custom category field for the price, and provide a dropdown to select which custom field contains the shipping price.

Probably the most important thing to think about will be defining what happens when more than one product is added to the cart, or when a product belongs to more than one category. It sounds like you have an answer for this for your specific needs, but if you want to create a flexible calculator you might want to provide options for this as well.

  • Yeah I was thinking of pulling from a category group, then creating a custom shipping price field in the categories. This would be the most flexible in that an admin could change the prices themselves. If it more than one category is added or more than one category is set for a product, the larger price is taken. I'll see what I come up with...
    – Aaron
    Dec 27, 2012 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.