Skip to main content

Posts

Showing posts with the label WooCommerce

Life in Lockdown

I'm sure it will come as no surprise that the reason it has been so long since I have published a post is because all of our lives have been turned upside down during this current crisis.  My heart goes out to everyone doing it tough, as so many jobs - including people close to me have had their jobs be made redundant.  Fortunately in my position, things have only gotten busier. My day job is for a company in the field of wholesale distribution, and the when the virus has put us in lock-down, the Government called upon our company and other retailers to have a deliverable solution for essential items.  Proud to say that while our company has never pulled something like this before - we did so in only 8 days .  It only offered 4 item as packs of essentials, but we saw a great proof of concept. Just as quickly, has it now expanded to the full product line, with registration now open to all and not those just who are most at risk.  The solution we have applied is s...

WooCommerce: Turbo Product Imports

Well, this is really becoming a topic as part of a series !  Today's topic is going to be a little complicated, but it can really speed up any current integration's you may have between your WooCommerce and CMS/Product Management Systems you may have in place.  Let me first explain my current situation. The main issue, which turns in to a cumbersome work-around, is that our imges are all hosted on an external CDN.  As I have already covered , by using the REST API, despite you give the URL for each product's image, it still uploads it to the media library.  This comes at a cost of time, and for a heavy workload can be prone to connection timeouts. As part of my role, I put through many catalogues to a site, with a combined number of products in the 1000's - and it was quickly having to scale, so there had to be a better way.  I knew there were people who had desired to write posts directly to SQL , and what is a WooCommerce product? A custom post! Think L...

WooCommerce: Controlling an Asset CDN

Continuing on from my last post , I faced a new issue when it came to adding products and the associated images I was putting in (from Cloudinary ) was getting uploaded to the WordPress media library. Not only that, using the URL from my site instead of the CDN it had come from. Double up on all of my images, what a waste - and I want to host from the CDN to keep costs of bandwidth down.  So let me show you how I overcame it. Separating the herd What was interesting, is that it was keeping a record of the original source location, and I found I could filter these apart from the rest of my media library: With this in mind, I wrote a function around it so I could use it to give me a true/false if the given attachment was from this source. Attaching the hook Next, needed a way that as soon as an image was added, that it would update the attachment (post) pointing to the correct reference, and not to the file on our server. I found the add_attachment hook, which fires only...

WooCommerce: Utilizing Custom Attributes

I must admit, I have a quite a love/hate relationship when it comes to WordPress.  As with some frameworks, it often takes a bit of rewiring to be not so... controlling.  On the other end of the spectrum, it has an enormous community, and you'll almost never be out of work when it comes to being able to build and support.  Plus, to be fair, it is not as targetted directly to developers unlike other Content Management systems like October CMS . Back on topic, I have recently been given a requirement to integrate our internally developed product CRM with WooCommerce, and would like to cover one important aspect of it: custom attributes.  It has taken a lot of research to making it just the way we needed to, so allow me to share some of the things I have learned along the way. First, we need to add our products with our custom attributes, this topic, while it was available, didn't seem to be as documented as attributes with set options (terms) attached to it, so it ...