Making It 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 removing or re-arranging 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

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.

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. If some of those hooks are missing because the theme has removed them, the 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
Twentytwelve – Twentytwenty

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

Bridge (includes z-indexing on product pages which interferes with modal)
Shopkeeper (z-indexing issues interfere with modal)