Category: Uncategorized

  • Small things I learned about programming with chatGPT ( 4o,4.1,o3 )

    I make a living mainly as a programmer and for quite a few years now it’s about the WordPress ecosystem with focus on backend solution and circumventing the 3rd party code which wasn’t carefully thought about for extension purposes.

    TL;DR:

    • Figure out how to define your problem precisely. It might require multiple steps
    • That’s the important part: in case a solution was not found, ask/push the AI assistant to try and list more ways to do the – seemingly impossible – task. This point is important to me because I found out that sometimes it’s easy to be under the impression that this crazy machine can actually miss the obvious.
    • Same impression is true for the programmer as well. And in general : assume that perhaps there is another option to do the stuff you are trying to do. Use the AIA to list those, unmercifully. This provides another way to find a solution in cases where the options are unclear from the get-go.

    So, as part of it I chatGPT and Clause extensively, sometimes to figure out what to do in a situation with multiple possible paths to continue through. For example here are some common situations I face:

    1. Should I extend the built-in Elementor Carousel to provide the required visibility and functionality or is there a simpler option?
      Same for the lightbox functionality which are limited in Elementor and it’s not easy to figure out what do the many many 3rd party plugins offer
    2. How to use WhatsApp Flows API when a dropdown should display different set of options according to the selection in the first screen?

    Well, the full answer is that there is a lot more to figure out before making a decision. From making a think-tank with the customer to figure out what really is important for them to what what are the available solutions to what can be developed in such such number of hours.

    But I want to focus on the part of actually trying to solve a programmatic challenge. Let’s say we are trying to figure out what to do with the WhatsApp Flows API:

    • Multiple screen workflow is need
    • Some screen should show a different dropdown according to the previous selection
    • This can be done in Cloud API but requires more complex handling ( storing the user stage in conversation, for example ) while the Flows API is simpler but more limited, because the flow is configured from the beginning and is not dynamic.
    • The solution – actually simple and straightforward: define
      multiple dropdowns, each with a different set of options.

    What happened is the even the magnificent o3 didn’t provide this simple solution. Why? I’m not sure, perhaps because I focused the conversation in a way that made it bypass the solution. But the important point is that you can trust the machines to figure it all out all the time. Use it as a powerful but lacking assistant that requires you to storm its brain.

    That’s a little thing I learned.

  • A new WooCommerce plugin for autocompleting address

    So, we’ve published a new address autocomplete plugin which uses Google Places and Maps API. It works for both the classic WooCommerce checkout and the new Blocks based WooCommerce checkout.

    Why a new one?

    Well, we tried few and couldn’t find one that autocompletes also the state and postal code in a reliable matter. It was a surprise and we embarked on the journey for creating a custom but simple solution.

    What we found using Google Places legacy API was that the functionality lacks in two points:

    1. The state/region/county code sometimes doesn’t exist in the returned data from the API and if it is returned, it doesn’t match WooCommerce state codes. We are talking inner states, like “Bavaria” in Germany which has the official code “DE-BY”.
    2. Postal codes sometimes returned in parts.

    I do not know why it is like it is, but as far as I could try and test, the data remained the same.

    So what did we do?

    We used the Google Maps legacy API ( future: the new API ) to retreive the usual data and then used OpenStreetMap API to get the standard state codes and it worked beautifully.

    What’s next?

    The first thing in our roadmap is moving to the newer Google Places API. It allows for better accuracy and provides more information, such as the postal code. This would require coding a new custom address select screen.

    Furthermore, we want to implement cache for the OpenStreetMap API calls in order to keep the usage in the required limits, save their servers some load and make the plugin’s operation faster.

    Other stuff about the plugin

    We added some additional functionality:

    1. An option to test the plugin’s functionality for a specific WordPress user, selected from the admin panel.
    2. A house number check. A message appears when the autocompleted address does not include a house number. This might occur when the customer does not provide a house number and in the haste of buying clicks on the unnumbered address.

    That’s all for now.

  • Finally, my own blog

    Is it still cool?

    Not much to say. When I started coding I chatted with people on a non-HTTPS websites. Internet still had the glow of being the great means to connect humanity. Still is, but not in the same way as it was in my eyes back then, in the ICQ era. I might be wrong but one difference which symbolizes the change to me is the disappearance of anonymous self blogs and the diversity of forums that was back then.

    Anyway, I decided to finally make the step and open a blog to write about coding stuff I do. Currently mostly WordPress and PHP stuff. Let’s see how it goes.