Posted on

API Battle: Woocommerce vs ePOS

API was supposed to make life easier, not infuriate techs to the point of madness.

I’ve looked into API for product and channel control before, gave up after reading one page which described what it does in several directions with no information on how to start using it. No simple ‘this will talk to your office database and import products’. Nothing about what technologies can be used to call/push data.

We’ve come across another company with the same WooCommerce nightmare as us. Stock management across several channels and keeping it all current. So it’s time to do some more in-depth testing.

In theory, this should allow multiple services to talk to each other, such as invoicing and parts ordering. Reading all the API’s functions, and testing a simple integration, proves its nowhere near finished nor easy to use.

Our current development tests have run into similar issues since our client doesn’t see any logs or debugging information. We see Response 401 (unauthorized) on attempted writes to the API’s target, which makes no sense on Authentication. We’ve triple checked credentials on most of the tests. This one’s really a mind boggler, and has given me a few possibilities:

  • are the permissions carried across wc-api folders? Surely this would be controlled by the APIs keys?
  • Bug in the APIs code? webhook not implemented properly for /products/categories?
  • Server misconfiguration? Possible as there are lots of HTACCESS rules for bot and spam prevention. May be worth spinning up a new instance on development VPS?

Not really sure how to continue with my own tests. I can’t test the clients any more than looking at responses, as they already have a development and big multichannel looking at it. Localhost testing has worked with adding products, with basic authorization disabled. Something not possible on external servers.

I will look at accelerating work on the VPS to get some tests done. This API lark, in theory, should make my life easier, if it works. If all goes well, this leads to our next major project.

Posted on Leave a comment

A spanner in the works.

Our system builder plugin has thrown another spanner in the works.

A spanner along the lines of “You know what would work better for existing machines what need configuring by users?” Uhoh.. “The options being on the product’s page!”.  Thanks brain, been too busy on the builder to actually notice that.

Now that’s been thought up, I’m thinking of using that instead of starting a new product, limit choices on each machine tied to board/CPU. Offer a choice of a case instead of making the case a starting point.

Back to the start again, some of the stuff I can use from earlier work. Most of it won’t work in the new structure.

Another aim of the project was to use scripts and functions built into WordPress and Woocommerce rather than calling in more scripts, which would go out of date if hard coded. By using WordPress’s own libraries, we shouldn’t have to worry about jQuery for a while.

I’ll add the select method as an additional file to the Github repository of the project. Upon that update, I’ll final version that and start a new plugin for the product page customizer.

Posted on Leave a comment

Woocommerce Custom data in Custom product tabs

custom product tabs


Allow custom fields to be viewed in a custom product tabs in WooCommerce

Woocommerce as standard doesn’t come with a naming tab system. You get a choice of Product Description, Additional Information, and Reviews. While the options in Additional Information could work, it looks ugly and unmanageable with data imports.

Luckily, there is a way around it all. Make our own custom product tabs.

We import our product data into a Custom Field called ‘Specification’ , and set about creating a tab called ‘Specification’. This is done via child theme’s function.php.

This code will Add a tab called Specifications, and display data from a custom field called ‘Specification’ (yes I know, never updated it).. Remember to change name and custom field to what you want to use.


// woocommerce tabs
add_filter( ‘woocommerce_product_tabs’, ‘woo_new_product_tab’ );
function woo_new_product_tab( $tabs ) {
global $post, $product;
$specification= get_post_meta($post->ID, ‘specification’, TRUE);
// Adds the new tab
if (!empty($specification)) {
$tabs[‘test_tab’] = array(
‘title’ => __( ‘specification’, ‘woocommerce’ ),
‘priority’ => 50,
‘callback’ => ‘woo_new_product_tab_content’
}return $tabs;
function woo_new_product_tab_content() {
global $post, $product;
$specification = get_post_meta($post->ID, ‘specification’, TRUE);

get_post_meta is what calls the custom field data, via ‘ID>field name, True’. This code loads it into an array for formatting and placing in the tab. There is possibly an easier way to do all of this, but it works. Priority defines where the tab will show, 30 is where ‘additional information’ tab is so our code overrides it. The first tab has a default of 10.

Next we’ll need some Woocommerce templates in our child theme under Theme-Name/woocommerce, make sure ‘Single-product/tabs’ directory is there and create a new file called ‘Specification.php’  and ‘tab-specification.php’, These will tell WooCommerce what to display from where.

I’ve named the custom product tab ‘Specifications’, remember to replace that with your intended name.


* Specifications Tab
global $post;
$meta_content = apply_filters(‘the_content’, get_post_meta($post->ID, ‘Specification’, true));
<div class=”panel” id=”tab-specifications”>
<?php $heading = apply_filters(‘product_specifications_heading’, __(‘Product Specifications’)); ?>
<h2><?php echo $heading; ?></h2>
<?php echo $meta_content; ?>


// Get Custom Field “specifications” meta data
global $post;
$meta_content = apply_filters(‘the_content’, get_post_meta($post->ID, ‘Specification’, true));
if (!empty($meta_content)) { ?>
<li><a href=”#tab-specifications”><?php _e(‘Specifications’); ?></a></li>
<?php } ?>

Again, change the names (in this example ‘Specifications’) to what you want to use.



  • This will also auto-hide the tab from users if there’s no data in the custom field to display.
  • This has been tested in WooCommerce (upto 2.4.5, August 22nd 2015) and WordPress 4.3 with no issues. Should work fine unless something drastic changes in the way product templates work.
  • You can add information to this tab by adding data into the custom field on product edit pages. If you don’t see any section for custom fields, check under ‘Screen Options’ on the top right and check its enabled.
  • Custom fields should allow HTML code to be displayed in in most content, check your theme’s sanitation methods if HTML tags appear randomly in custom fields.


Thanks to Kieran Barnes and Sean Barton for their working examples and guides on how the tabs system works and its associated actions/filters.


Posted on

System Builder plugin V1

I’m returning to an old project in an attempt to make it worthwhile.

Basically, it’s an array driven visual product chooser, with some customization options to help in almost every sector of selling. It started out as a Computer builder, but can be used to make anything.. Camera kits to picnic baskets.

By choosing a parent category, it read what products were in each and presented them in a grid with switchable category buttons. With an ‘add to cart’ button and information panels on each product, the page called ‘minicart’ into the sidebar to show the user what they choose before and keep track of it all.


The upcoming version 1

As my first plugin, and a sort of mash-up of a previous plugin, there’s a fair amount of redundant functions and code.  A fresh start with the install script and functions, try to trim everything back to core functions. I’d also like some item restrictions to help users.. like Only choosing 1 case, a limit of 4 sticks of ram etc.. At the moment, a user can choose multiple of every case to add to their system. One fix for this was to adjust the standard Minicart to have a ‘remove item’ button in theme, a fix which will be outdated when WooCommerce updates that file in their core.

The fixed amount solution, when solved will complete V1, updates are being done on Github to tidy up code in preparation for the finished version.

Ideas for Version 2

Currently, it looks like this:



I’m looking at other styles such as a drop down select for each category (choose a name with associated price and it appears beside) or an image button of the product with the meta (price/info) appearing in a layer when the mouse hovers over it.

The drop down selection (or even radio buttons) would be better suited to prebuilt systems which can be customized. This requires a sort of ‘Custom Product Type’ what doesn’t work well with WooCoommerce (unless you like a big yearly subscription for their own solution which I can’t even see works how I want it)

Anyway, brief Work In Progress on this project, and aiming to make something work. In its Current state I will be tidying up code and releasing as V1 on Github. V2 will be a product based solution and not Array (hopefully), as such maybe a paid plugin, or partly free with paid addons. Or the extreme route I thought up the other day of ditching Woo and going with our own cart/inventory system, that would be a long few years.

Upon investigating how Variations and Attributes work, it seems there is no ‘out of the box’ solution at all (unless you want to pay yearly for something what doesn’t look like it’ll do the job, adapt per product rather than have the choices all available when you start..). It’d be nice if we could select categories as attributes to save us importing component information again and have something dynamic.

The Process would be:

  • Call an array of products, tags of whats compatible which each.
  • place products in presentable drop down or button/radio selections.
  • Show user information on products, prices and/or compatibility information.
  • save selected options to an array, calculate the price and update dynamically.. Or automatically move items to cart and update each time user choose something.

As you can see. Not easy with a set of non-focus choices. Still lots to do for it, hoping to solve the amounts issue by end of the month (July) and start the new version early September.