Making Gift Wrapper Work For Everyone

Every once in a while we get a report that the Gift Wrapper plugin “doesn’t work.”

Putting aside the fact that it’s just not enough information to help anything, oftentimes we find it’s not the plugin that is “broken.” It’s the theme.

More and more we are finding that premium WordPress themes (with WooCommerce “support”) are doing one or two things with their code which interferes with how plugins can cooperate to make a great website.

  1. Z-index issues
  2. Hook (action/filter) issues

Z-index issues

Themes and plugins sometimes use CSS z-indexing to create stacking panels, for example, sticky headers that hide a part of the screen below. Unfortunately, Wild West

stacking, with numerous plugins and then the theme all setting z-indexing, can prevent pop-ups/modals from showing. If your pop-up is greyed out and you can’t click its buttons, maybe first check your browser error console to make sure you don’t see any JavaScript issues. If you don’t see JS errors, it’s probably just CSS z-indexing getting in the way. Often z-indexing can be re-stacked with some custom CSS added to your child theme or WP/theme options “custom CSS” panel.

Here are some helpful reference articles to help you learn more about z-indexing:

4 reasons your z-index isn’t working (and how to fix it)

The Z-Index CSS Property: A Comprehensive Look

Hook issues

Plugins sometimes remove or re-arrange critical WooCommerce hooks that developers use to add functionality. As soon as these hooks are added back in, plugins like ours start working again.

An example of missing hooks

The Bridge theme, with over 125,000 sales, has inexplicably removed the hook ‘woocommerce_after_cart_item_name’ from the woocommerce/cart/cart.php template. For the Gift Wrapper plugin, this hook allows the “Add Gift Wrap?” prompt to show after each line item product name in the cart. So, for customers trying to use Gift Wrapper with the Bridge theme, that prompt does not show.

If your theme authors have for some reason tampered with the ‘woocommerce_after_cart_item_name’ hook, e.g. removed and re-named it, the prompt link for wrap will not show.

Let’s Fix Bridge

The best option is to create a cart.php template override in a child theme /woocommerce/cart folder, and add the hook back in!

do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );

The line above is the hook needing back in. Where to add in that line of code? Add it in right before where you see this line:

/*** Our code modification inside Woo template - end ***/

The hook omission in the Bridge theme is still in place as of version 19.2.1, but was noted in version 18.0.6. It’s unclear why they chose to omit the ‘woocommerce_after_cart_item_name’ hook, but it could have been accidental. I’ve contacted the theme developers and hope to hear more.

The Moral

The moral of the story is… WordPress and WooCommerce use “hooks,” like clothes hooks, on which plugins can hang their wares (add-on functionality). Themes and plugins can also remove hooks, or move hooks. If some of those hooks are missing because the theme has removed them, third-party plugins have no way to add functionality. If the problems with the theme are not addressed, the user will continue to struggle with plugins.

Themes confirmed to work:

Avada (needs Bootstrap JS dequeued in Gift Wrapper settings)
Go (from GoDaddy)
Hello Elementor
Wordpress’ Twentytwelve through Twentytwenty

Themes with confirmed troubles:
The following themes remove the necessary ‘woocommerce_after_cart_item_name’ action hook:

Bridge (includes z-indexing on product pages which interferes with modal)
Node (similarly to Bridge theme, has removed the ‘woocommerce_after_cart_item_name’ hook so line item wrap prompts do not show)
Shopkeeper (z-indexing issues interfere with modal)
The Retailer (“after cart” wrapping covered up by rest of cart, and disappears. Try this CSS to un-bury it: .giftwrap_after_cart{clear:both})

If you are using one of these themes, we recommend you contact the theme authors and request they add the ‘woocommerce_after_cart_item_name’ back in place where it should be.