← Projects

Click & Collect plugin for Craft Commerce 2

June 3, 2019

My latest plugin Click & Collect for Craft Commerce allows you to quickly start accepting in-store pickups by providing a custom shipping method and the ability to manage store details.

The plugin provides a way to manage multiple store locations. All store information is stored conveniently in Crafts already existing address management table for consistency. It also provides you with a custom shipping method which can be used to build a desired checkout process (more on this below).

To store the customers selected store during checkout I tap into a few of Crafts/Yiis powerful features. When a cart is updated the plugin listens for a special field (which can be controlled via settings) using Events and if it's detected I use a Behavior to update the order. This allows me to tap into Craft Commerce features without having to extend or change class inheritance which can sometime increase plugin overhead and make updates harder.

As for the CMS side of things, I also built a custom field which can be added to orders. This field provides a tidy way of seeing what store was selected if a customer selected to pick their order up in-store.

You can then use features like Order Statuses and Order Emails to help manage orders and keep customers up to date e.g. "Your order is ready to be picked up".

For more documentation and examples check out the plugin on Github.

What about the front-end?

When planning the features of the plugin I had to make a decision whether or not to include some kind of front-end widget which would basically allow for a 1-click-install similar to Shopify alternatives.

I came to the conclusion that each online store is so different e.g. specific checkout requirements, business logic and even the look & feel of the site itself - it would be much better to focus on features under the hood rather than building a 1 size fits all widget.

I think my decision aligns with Craft Commerce itself as it's very much a custom solution and if you're using it, you probably have specific requirements or a preferred approach.

I did some research into what large e-commerce stores do to provide this option during checkout and it looks like the most popular approach is to ask the customers during step 1 if they would like their order delivered or if they would like to pickup in-store. From there you can manage the rest of the checkout process accordingly. For example if they chose pickup then a nice UX is to then for them to select a desired store from a list or maybe even from a Google Map.

What's on the roadmap

  • An API or endpoint that allows better searching of stores (useful for larger stores).
  • Upgrade Stores to be Craft Elements and not just Records - this would allow developers to add their own custom fields to stores like open hours, maps and relate stores to specific entries.
  • "Getting started" front-end code snippets.
  • Dashboard / Widget to provide statistics like Delivery vs Pickup, Total Orders Picked up, most popular store and so on.
  • Run sheet to assist with order management

Want to try it out?

To try the plugin out now either install it via the Plugin Store by searching "Click & Collect" or via composer.

$ composer require mediabeastnz/craft-commerce-click-and-collect