Blog Major release

Major changes in Gift Wrapper 6.0

Gift Wrapper six point oh (version 6.0) has been in the works for a very long time. Health issues, a super snowy Winter and wet Spring, and other distractions have slowed it down.

But it’s finally ready!

We are really glad for this update, because it not only adds quite a few features, but means more people can use the plugin to benefit their sales.

Why Version 6? About Versioning…

Like a lot of modern software, Gift Wrapper uses semantic versioning. This means the move from 5.xx to version 6.0 is a major change, and things *might* break. Of course we have to warn you, but we anticipate things will break only if you have overwritten Gift Wrapper templates in the past, use Elementor templates for WooCommerce endpoints, and possibly if you are using Gift Wrapper filter/action hooks. If either of those sound familiar, please keep reading and make sure you are ready for the upgrade. Take backups, test on a development server, and feel free to ask questions!

Ideas Behind the Refactoring

One big reason for the refactoring is that we needed to be able to hook the Gift Wrapper prompts (vanilla JS modal, jQuery slide down, a checkbox display) to more locations amongst WP structures. Many themes have unfortunately deleted core WooCommerce hooks. This hobbled Gift Wrapper and other plugins which rely on those hooks. To get around this, we are just making it easier for people to hook into nearly any position, other than the previous 5 options. Version 6 of Gift Wrapper allows the user to simply type in the name of the action hook where you’d like Gift Wrapper to appear on a cart or checkout page. Because the Gift Wrap addition now functions using AJAX instead of a form submit, the prompts do not need to be anywhere in particular on the page.

The templates were also re-written to make sure that even if several locations were used on one page, they would not interfere with one another. To do this, full WooCommerce hook names were used for “labels” in the templates instead of vague labels such as “_before_cart” and “_after_cart”.

Allowing more locations meant thinking outside the box when it came to working with the WooCommerce cart form. Previously most hooks inside the form were avoided. We can now process Gift Wrapper Plus product additions inside cart and checkout pages by using AJAX instead of listening for cart change $_REQUESTs.

Elementor Integration Refactoring

Please note folks using Elementor will have no backward compatibility. Elementor Gift Wrapper widget used to show more features but that wasn’t making much sense. Elementor Gift Wrapper widgets use the main Gift Wrapper settings now.

Version 4 (and below) custom template support dropped

Well, not exactly. Until version 6, there was a setting which allowed old custom template overrides to continue being used. This setting was dropped because it will create confusion going forward. If somehow someone out there is still using an ancient template, then the following code can be added to the child theme functions.php file to carry on in the absence of the checkbox setting. In case you’re curious about the difference, Gift Wrapper version 5 started using wc_get_products() instead of get_posts() to fetch a list of gift wrapping products.

add_filter( 'wcgwp_lt5_templates', '__return_true' );

Meanwhile, Some Features Were Added!

  • Using the checkbox template, more than one checkbox (gift product) can be displayed… or just one
  • There is now a checkbox template for the peri-cart wrap placements (around the cart/checkout pages), not just product pages
  • Theme- and WooCommerce-native button styling, with more obvious precedence/flow indicated by color (per theme)
  • Consistency between product page and cart page modal appearance
  • Gift Wrapper now allows indiscriminate prompt placements on the product page
  • Improved Elementor integration

That’s it for most of you. If you want to continue reading the nitty-gritty, keep on… Thank you!

Constant changes


CSS selector changes

wc-giftwrap => wcgwp-wrapper
modal-alt => wcgwp-modal-alt
giftwrap_header_wrapper => wcgwp-prompt-wrapper
wcgwp_detail_holder => wcgwp-detail-holder
giftwrap_title_wrap => wcgwp-title-wrap
giftwrap_title => wcgwp-title
giftwrap_ul => wcgwp-ul
singular => wcgwp-singular
singular_label => wcgwp-singular-label
giftwrap_li => wcgwp-li
giftwrap_desc => wcgwp-desc
giftwrap_thumb => wcgwp-thumb
no_giftwrap_thumbs => no-wcgwp-thumb
wcgwp_product_input => wcgwp-input
giftwrap-single => wcgwp-product
wcgwp_single_checkbox => wcgwp-checkbox
giftwrap_simple => wcgwp-checkbox
wc_giftwrap_notes_container => wcgwp-note-container
wc_giftwrap_notes => wcgwp-note
giftwrap_cancel => wcgwp-cancel
giftwrap_submit => wcgwp-submit

CSS selectors that have been removed

giftwrap_title_holder => ”
replace_wrap => ”
wcgwp_modal_body => ”

Post meta changes

$cart_item[‘wcgwp_product_price’] => $cart_item[‘wcgwp_price’]
$cart_item[‘wcgwp_line_item_price’] => $cart_item[‘wcgwp_price’]

$cart_item[‘wcgwp_product_parent_key’] => $cart_item[‘wcgwp_parent_key’]
$cart_item[‘wcgwp_line_item_parent_key’] => $cart_item[‘wcgwp_parent_key’]

$cart_item[‘wcgwp_product_parent_id’] => $cart_item[‘wcgwp_parent_id’]
$cart_item[‘wcgwp_line_item_parent_id’] => $cart_item[‘wcgwp_parent_id’]

$cart_item[‘wcgwp_product_parent_name’] => $cart_item[‘wcgwp_parent_name’]
$cart_item[‘wcgwp_line_item_parent_name’] => $cart_item[‘wcgwp_parent_name’]

$cart_item[‘wcgwp_product_selection’] => $cart_item[‘wcgwp_selection’]
$cart_item[‘wcgwp_line_item_selection’] => $cart_item[‘wcgwp_selection’]

Product meta changes

‘wcgwp_selection’ => ‘wcgwp_name’

wcgwp_product_id is now an array that holds the wcgwp_price and wcgwp_name values, e.g.

'wcgwp_product_id' = array( [344] => array( 'wcgwp_price' => 4, 'wcgwp_name' => 'Gold Gift Bag', ) );

(where 344 is the product ID)

Method changes

WCGWP()->wrapping->giftwrap_in_cart() [has wrapper function] becomes wcgwp_wrap_in_cart()
WCGWP()->product->add_with_gift_to_cart() [deprecated] becomes WCGWP()->product->add_wcgwp_item_to_cart();
get_wcgwp_products() becomes wcgwp_get_products()
wcgwp_get_products() becomes pluggable


To top