Just like a ship in the ocean collects barnacles, WordPress plugins collect… barnacles. Haha, but no really, they collect dust in dark corners and things sometimes break without even being noticed. I certainly didn’t intend for major version 5 to follow so closely behind version 4, but some really good feature requests led to a good barnacle scraping and to pulling a trigger on a breaking change that I had earmarked for v5 at some point. That point is now.
Note: this is a beta! You don’t have to upgrade if you do not want to. Version 4.3+ is stable.
The biggest change
Any time your site shows a grid of gift wrap-type products to a customer, the plugin queries the database to decide which products to show. Previous to version 5.0, the plugin used a custom query, which retrieved WP post IDs. The plugin now uses the WooCommerce-native, future-proof wc_get_products() function to fetch a list of gift wrap products. Whereas previously WordPress post IDs were sent to the templates, version 5.0+ sends WC product objects. This change could break things in cascade for template users*. Quite a bit of escaping needed to be done in the templates anyway, and so I rolled up my sleeves, grabbed my barnacle scraper, and decided to start work on another major version.
Aside about Versioning
What do I mean by “major” version? Major versions don’t necessarily mean they took a lot of work, although version 5 did! A major version is a breaking version. Let me explain. I’ve been using semantic versioning for several years now. If you weren’t aware, a major version is like version 1 to 2, or version 4 to 5. Version 1.0 to 1.0.1 would include something helpful and harmless like a bug fix. Version 1 to 1.1 would include feature additions and maybe bug fixes. A major version is potentially breaking, meaning it can break your website. Similarly any beta version can be breaking. Both should be used with caution, with file/database backups being made BEFORE endeavoring forward.
It’s in Beta
Version 4.3.3 is stable and received a lot of the same scrubbing that version 5 did. So it’s safe to stay put. But if you want to venture into the magical land of version 5, with its features, turn on your beta access in the Gift Wrapper > General Options > Advanced settings. The plugin will ping the update API on WordPress’ usual schedule and if there is a current beta, you will be notified on your Plugin page.
Keep in mind it is literally impossible to test all the combinations of GiftWrapper + theme + numerous other WP plugins in tandem. I test with a couple dozen themes and with many standard WP and WooCommerce plugins, including the plugins with stated compatibility, before releasing. If there are surprises, I rely on you to let me know so that I can fix them.
Overall I’m excited about version 5 because it is faster, more secure, and relies on more built-in WP/Woo functionality to get the same job done. There are also a couple new features.
- There are now separate gift wrap category settings for order wrapping and for product wrapping. This means you can sell one category of wrap in the cart, and another category in the product pages, without having to set products one-by-one to override the main cart/checkout category. A use case for this could be shops who wish to sell a type of wrapping on the product pages, and then offer a choice of notecards during checkout.
- For people wanting to take more advantage of cart item wrapping (wrapping per-product inside the cart), version 5 listens for the ‘woocommerce_after_cart_item_name’ hook on checkout and Elementor pages also.
- Maybe not so much a feature as a “must,” gift wrapping now obeys the WooCommerce “sell individually” setting. Setting a wrap to be sold individually is another way to control how much of it ends up in the cart.
* Are you a template overrider?
Generally if you were using template overrides, you would know it. To do so involves moving files and writing code. If you haven’t done any such thing with Gift Wrapper Plus, the move to 5.0 should be pretty painless. Still, as always, in precaution: take your backups. Do this before updating ANY plugin. If you’re not a template overrider, you can stop reading here. 🙂
Template changes to watch out for
If you haven’t made any changes to plugin templates, then disregard this topic. Usually you’d know if you have made changes, because this involves coding, and moving files into a /woocommerce/wcgwp/ folder inside your theme.
In every template watch for the use of $product inside the foreach: it should be a product object. Once this product object is established, it is then used to fetch the product title, ID, price HTML, permalink, etc. All of these references will need to be updated. If you need assistance updating a template you have overwritten to the new style, please get in touch.
This file is replaced with checkbox-product.php and the main breaking change is the name of the <input>. Keep in mind, the option ‘wcgwp_checkbox_textarea’ is now deprecated. Textarea presence – or lack thereof – throughout the entire plugin depends on the textarea length setting. If set to zero, textarea inputs won’t show. If you’ve read this far you’re aware this can be changed ad lib using template overrides anyway, so two settings for the same process was deemed overkill.
giftwrap-list-elementor.php and modal-elementor.php
Because they only styled the admin-side Elementor builder, these templates were removed.