Woocommerce Gift Wrapper

Omschrijving

Holidays and birthdays are always coming! Offer your customers gift wrapping or similar bonus, per order, in the WooCommerce cart.

Gift Wrapper treats your wrapping service as a WooCommerce product, allowing it to be inventoried, priced, and taxed separately. Create and offer as many gift wraps as you like, where you like. If you need more features and functionality such as per-product wrap options, try out the PLUS version of Gift Wrapper from Little Package (not to be confused with a similarly-named but different plugin sold by Woocommerce since March 2020).

Some Features

  • Create a simple gift wrap (or other add-on type) option form on the cart and/or checkout page, or go all out with robust gift wrapping offerings
  • Set individual prices, descriptions, and images for wrapping types
  • Show or hide gift wrap images in cart/checkout
  • Static (slide-down) or modal view of gift wrap options on cart and checkout pages
  • Get notice of the customer’s intended gift wrap message by email order notification and on the order page – customer also receives confirmation
  • Fully CSS-tagged and templated for your customizing pleasure.
  • If you have suggestions for other features, find a bug, or have a translation, please get in touch.

Support future development

I need your support & encouragement! If you have found this free plugin useful, and especially if you have benefitted commercially from having a gift wrapper for WooCommerce, please consider donating to support the plugin’s future on the WP repository:

paypal.me/littlepackage

I understand you have a budget and might not be able to afford to pay the developer (me) a small tip in thanks. Maybe you can leave a positive review?

Please leave a review of WooCommerce Gift Wrapper

Purchase WooCommerce Gift Wrapper Plus

Translations

Take a moment and help Translate Gift Wrapper into your language!

Thank you!

Schermafdrukken

  • Screenshot of the settings page (WooCommerce -> Settings -> Products -> Gift Wrapping submenu)
  • Screenshot of a modal (a site using the Mystile WooCommerce theme)

Installatie

To install plugin

  1. Upload the entire “woocommerce-gift-wrapper” folder to the “/wp-content/plugins/” directory.
  2. Activate the plugin through the “Plugins” menu in WordPress.
  3. Visit WooCommerce->Settings->Products tab to set your plugin preferences. Look for the “Gift Wrapping” sub tab link.
  4. Follow the instructions there and review the settings.

To remove plugin:

  1. Deactivate plugin through the ‘Plugins’ menu in WordPress
  2. Delete plugin through the ‘Plugins’ menu in WordPress
  3. NOTE: Your settings will be deleted from your WP database when the plugin is deleted

FAQ

It doesn’t seem to work

Things to check:

  1. Is the WooCommerce Gift Wrapper plugin activated?
  2. Is WooCommerce activated and configured, and are all the theme files current (check WooCommerce->System Status if unsure)
  3. Are you using WooCommerce version 3.0 or newer? Time to upgrade!
  4. Have you created at least one gift wrap product, saved it to a product category, and entered that product category in your Gift Wrapper settings?
  5. Does the your-theme-or-child-theme/woocommerce/cart/cart.php file include at least one of the following hooks?

    do_action(‘woocommerce_before_cart’); or
    do_action(‘woocommerce_before_cart_collaterals’); or
    do_action(‘woocommerce_after_cart’); or

5a. Does the your-theme-or-child-theme/woocommerce/checkout/form-checkout.php file include at least one of the following hooks?

do_action('woocommerce_before_checkout_form'); or 
do_action('woocommerce_after_checkout_form');

Due to third-party theme and plugin overrides, these hooks might be moved or removed. If you can’t find any of these hooks in your WooCommerce installation, you are missing a crucial hook(s) to the functioning of this plugin. Try using a different location for the “Where to Show Gift Wrapping” in the plugin settings, and if that doesn’t work, try the Storefront theme and disable all plugins except WooCommerce & Gift Wrapper to rule out theme/plugin interference.

Other problem? Please let me know before leaving negative feedback! I can usually reply to tickets within 24-48 hours.

Why isn’t gift wrapping added when I click the button in the cart?

Have you added a gift wrapping as a WooCommerce product? This plugin works by creating a product that virtually represents gift wrapping. It is up to you whether that product is visible in the catalog or not, and how fleshed-out you make the product description. But there needs to be a product, and it needs to be in a category whether or not you make more than one wrapping types. That product category is used in the Gift Wrapping settings.

Why make more than one type of wrapping?

Maybe you want to offer “Winter Holiday” wrapping and “Birthday” wrapping separately, or maybe you have other types of gift wrap service: wrapping paper or boxes you use that may incur different prices or shipping rules. It’s up to you whether or not you make more than one wrapping product. You don’t have to.

How can I style the appearance?

I’ve added CSS tags to every aspect of the cart and checkout gift wrap forms so you can style away. Please if you do not know basic CSS, hire a developer to do this for you. We need jobs, too!

If you would like to change the HTML structure of gift wrap lists and modals, you can use the Gift Wrapper templating system to do that easily.

You will need to create a folder called woocommerce in your theme — or better yet — child theme folder. Inside that folder, create another folder called wcgwp. Move any overwritten plugin template files into this wp-content/theme/woocommerce/wcgwp folder, and your changes will be visible. Read more information on WooCommerce templating here.

Can I change the giftwrap thumbnail size?

Yes, use the ‘wcgiftwrap_change_thumbnail’ hook in your (child) theme functions.php file as follows:

function my_custom_thumbnail_size( $thumbnail ) {
    $thumbnail = 'medium';
    return $thumbnail;
}
add_filter( 'wcgiftwrap_change_thumbnail', 'my_custom_thumbnail_size', 10, 1 );

This is just an example. Change ‘medium’ to the size desired, using an existing WordPress image size slug.

I don’t want more than one wrapping added to the cart!

Yeah, that could be a problem, but rather than hard-code against that possibility I leave the settings to you, and for good reason. If you don’t want more than one wrapping possible, make sure to set your wrapping product to “sold individually” under Product Data->Inventory in your Product editor. If you do this make sure your customer has a way to remove the gift wrapping from the cart on small screens, as sometimes responsive CSS designs remove the “Remove from Cart” button from the cart table for small screens.

Gift wrapping seems to interfere with shipping costs

To prevent this happening, I recommend you set up your gift wrap products as WooCommerce “virtual” products (virtual but not downloadable). If setting them up as regular or variable products, make sure to arrange the shipping settings so they don’t incur surprise shipping costs.

I don’t want to show gift wrapping in my catalog

Visit your gift wrap product (WooCommerce product editor screen) and set Catalog Visibility to “hidden” in the upper right corner near the blue update button. If you have more than one gift wrap product, do this for each one.

I don’t want to show something

This plugin is heavily CSS-tagged. If you don’t want to show a part of what Gift Wrapper displays, add custom CSS to your WordPress theme settings, WordPress theme css (usually style.css), or – better yet – WordPress child theme CSS file (style.css). WordPress also allows CSS to be added in the Customizer.

An example might be:

Let’s hide the gift note textarea/textbox. Add this CSS to your theme:

.wc_giftwrap_notes_container textarea {display:none}

or

.wc_giftwrap_notes {display:none}

Both would work. I cannot support all the requests for free custom theme help any longer! Please study up CSS or hire a developer to help you make custom theme and plugin modifications. WooCommerce has provided some recommendations for where to seek help. Thank you for understanding.

To hide “Giftwrap Details,” you used to be able to just leave the setting blank (pre version 3.0.3). Now you can either use CSS or the ‘wcgwp_hide_details’ filter hook to hide it. To use the hook, add the following code to your functions.php file:

add_filter( 'wcgwp_hide_details', '__return_true' );

You can also adjust the HTML output using the template system (as of version 3.0).

How can I hide gift wrapping when there are only virtual products in the cart?

Easy, add the following line of code to your (child) theme functions.php file:

add_filter( 'giftwrap_exclude_virtual_products', '__return_true' );

If you’re unfamiliar with how to edit the functions.php file, add this code using the Code Snippets plugin.

How can I remove the COD payment option if gift wrap in cart (purchase is probably a gift) ?

Easy, add the following line of code to your (child) theme functions.php file:

add_filter( 'wcgwp_remove_cod_gateway', '__return_true');

I would like this plugin in my language, or to say something different on screen

This plugin comes ready with a .POT file. If you aren’t already familiar with localisation (translation) of WordPress plugins and themes, you can learn more here. You can add .PO files to the /lang folder of this plugin to change it to your language, or even to just adjust the English currently used.

To change what this plugin says on screen, create PO/MO file(s) in your language. If your site is in English (US), then you would be creating a PO file called woocommerce-gift-wrapper-en_US.po and putting it in the /lang/ folder inside the WooCommerce Gift Wrapper plugin folder (/wp-content/plugins/woocommerce-gift-wrapper/lang/). If your site is in French (France), your PO file would be /wp-content/plugins/woocommerce-gift-wrapper/lang/woocommerce-gift-wrapper-fr_FR.po. Note in this case, you would be editing or overwriting the existing po file for French.

I recommend Poedit to get string translations done quickly and simply.

Another option is to use WordPress filter hooks included with most strings in this plugin. Here’s an example for changing the “Add Gift Wrap?” text:

function my_change_wrap_prompt( $prompt ) {
    $prompt = 'Would you like to wrap this?';
    return $prompt;
}
add_filter( 'wcgwp_add_wrap_prompt', 'my_change_wrap_prompt', 11, 1 );

Now the text will say “Would you like to wrap this?” This PHP code could be added using the Code Snippets plugin if you do not have a child theme and are not comfortable editing your child theme functions.php file or with PHP at all.

The PLUS version of this plugin allows for easy string translation by using a settings panel — just type what you want it to say.

How can I translate the “Giftwrap Details” (found in Gift Wrapper settings) when using WPML?

This string is saved in the WordPress options database table and so it takes a little extra work for WPML to find it. Follow these instructions in the WPML documentation to find the ‘wcgwp_details’ database value and translate it.

The popup (modal) doesn’t work with my theme

Most likely this is due to your WordPress theme conflicting with this plugin. Oftentimes, themes use aggressive CSS z-indexing to make page sections “float”. This can cause third-party modals (from any plugin, not just this one) to fail. If you do not know how to correct z-index issues with some custom CSS, please bring this issue up with your theme author and/or your developer.

This plugin breaks my theme

I’m sorry I am not responsible nor for hire to make this plugin work with every theme out there. Some themes just, well… suck. It works with most themes I’ve tried, both paid and free, and I offer it gratis and as is. If you have suggestions for how to make it work for your theme, I will consider hard-coding in your theme fixes. Thank you for understanding.

Beoordelingen

29 maart 2021
Really good plugin, works straight out the box. Support is first class too.
14 februari 2021
Very nice support! Really helped me out. Thank you so much.
Lees alle 43 beoordelingen

Bijdragers & ontwikkelaars

“Woocommerce Gift Wrapper” is open source software. De volgende personen hebben bijgedragen aan deze plugin.

Bijdragers

“Woocommerce Gift Wrapper” is vertaald in 6 talen. Dank voor de vertalers voor hun bijdragen.

Vertaal “Woocommerce Gift Wrapper” naar jouw taal.

Interesse in ontwikkeling?

Bekijk de code, haal de SVN repository op, of abonneer je op het ontwikkellog via RSS.

Changelog

4.5.1 – 15 October 2021

  • Stop nonce check on every cart/checkout page load, use only with certain $_POST values
  • Translation updates

4.5 – 4 October 2021

  • Fix for use with Gutenberg editor while using ‘giftwrap_exclude_virtual_products’ filter, involves
    moving hooked functions from ‘init’ to ‘wp’ (later firing)
  • Fix – nonces added to frontend forms
  • Renew nag

4.4.10 – 28 September 2021

  • Testing with WC 5.7. WooCommerce requires PHP version 7.0, and so therefore so does this plugin.
  • Testing with WP 5.8

4.4.9 – 13 September 2021

  • Testing with WC 5.6

4.4.8 – 11 August 2021

  • Testing with WP 5.8

4.4.7 – 1 July 2021

  • Minor tweak in classes/wcgw-admin-notices: use printf not sprintf
  • Testing with WC 5.4

4.4.6 – 3 March 2021

  • Do not show non-purchasable or out-of-stock wraps when showing wrap lists
  • Testing with WP 5.7

4.4.5 – 12 February 2021

  • Testing with WC 5.0
  • Remove bad link in settings page – free users do not get per-product settings page oops
  • Add ‘woocommerce-gift-wrapper’ textdomain to WP Language directory – localized

4.4.4 – 25 December 2020

  • Tweak – get_posts() arg changed from to ‘posts_per_page’ to ‘numberposts’ & ‘no_found_rows’ added for speed

4.4.3 – 1 December 2020

  • Fix – recover template changes lost in 4.4.2
  • Tweak – suppress_filters set to TRUE if not WPML

4.4.2 – 27 November 2020

  • Tweak – return to using instantiated var $wrapping as instance of class WCGW_Wrapping

4.4.1 – 24 November 2020

  • Fix – textdomain wrong in templates/wcgwp/giftwrap-list.php

4.4 – 23 November 2020

  • Fix – correct textdomain in several files, was ‘woocommerce-gift-wrapper-plus’ should be ‘woocommerce-gift-wrapper’
  • Feature – allow some HTML to be saved for the Gift Wrap Details field
  • Feature/Tweak – Incorporate a vanilla Modal script instead of Bootstrap to cut down on theme conflicts
  • Feature/Tweak – For UX, make image of wrap next to radio button clickable if not already a link to product
  • Feature/Tweak – for slideToggle wrap display, show “Cancel” prompt instead of constant “Add gift wrap?”
  • Tweak – One wcgwp template deprecated but will continue to work: templates/wcgwp/giftwrap-list-cart.php
    Its replacement – templates/wcgwp/giftwrap-list.php – especially affords more stylistic control of both the open toggle and submit buttons
  • Tweak – Make plugin instructions more clear on settings page
  • Tweak – esc_url() on wrapping image URLs
  • Tweak – Set DB options autoload = FALSE
  • Tweak – make sure frontend jQuery is enqueued when scripts needed
  • Tweak – update Bootstrap CSS from 4.0 to 4.5.3
  • Tweak – increase z-index on modal pane
  • Tweak – Refresh CTA because only two people loved me
  • Testing with WooCommerce 4.7

4.3.1 – Oct 25 2020

  • Tweak to three templates to add filter ‘wcgwp_add_wrap_message’ for changing screen text: modal.php and giftwrap-list-cart.php
  • Reverse order of changelog per request; archive some of it.
  • Remove deprecated/unused templates (coupon-header.php and coupon.php)
  • WooCommerce testing to version 4.6

4.3 – Oct 6 2020

  • Compatibility with WPML
  • Domain Path in readme.txt maybe missing opening slash /
  • Add instruction to readme.txt for WPML users wanting to translate the elusive “Details” string
  • Reinstate nag because nobody loves me

4.2.5 – Sept 18 2020

  • Readme.txt changes

4.2.4 – Sept 16 2020

  • Same as 4.2.3

4.2.3 – Sept 16 2020

  • Fix – Do not echo button text before ‘wcgwp_add_wrap_button_text’ filter runs

4.2.2 – Aug 5 2020

  • Tweak – Rename options for less chance of DB conflict
  • Tweak – Leave no trace (delete all DB options on plugin uninstall) option added
  • Testing with WP version 5.5

4.2.1 – July 31 2020

  • Tweak – CTA for free users, this plugin may or may not be sustainable without your support

4.2 – July 1 2020

  • Feature – ‘wcgwp_add_wrap_prompt’ and ‘wcgwp_add_wrap_button_text’ filters added to gift wrap prompt and button
  • Tweak – remove use of anonymous function for gift wrap placements in cart and checkout areas
  • Testing with WC 4.2.2

4.1.2 – May 6 2020

  • Tweak – default selected gift wrap set if more than one selection, so that no empty $_POST value sent
  • Testing with WP 5.4.1
  • Testing with WC 4.1

4.1.1 – April 9 2020

  • Testing with WP 5.4
  • Testing with WC 4.0.1
  • Update POT file

4.1

January 20 2020 =
* What happened?

4.0.5 – December 15 2019

  • Fix – Required WP version moved from 4.0 to 4.9

4.0.4 – December 8 2019

  • Fix – Order meta replace ‘wcgwp_note’ with “Note” on order confirmation / admin order pages

4.0.3 – December 4 2019

  • Fix – remove unnecessary “#” action from line item wrap forms (in templates)
  • Fix – add Post/Redirect/Get to peri-cart/peri-checkout wrapping so wrap is not added back to cart after delete + page refresh
  • Tweak – Woocommerce order item meta stored in key value ‘wcgwp_note’ – consistent with Plus version of plugin
  • Tweak – Update readme.txt to reflect changed and new hooks in use
  • Update translation files

4.0.2 – November 22 2019

  • Fix: Stripslashes for customer input
  • Testing with WooCommerce 3.8

4.0.1 – October 3 2019

  • Fix: After checkout positioned wrap not correctly added to cart d/t $_POST values not being caught
  • Fix: Slideout after checkout conflicting with before checkout position – ensure both work

4.0 – September 29 2019

  • Feature: ‘wcgwp_remove_cod_gateway’ boolean filter hook in case COD not wanted with wrap in cart/order
  • Feature: add “after checkout” location for gift wrap prompts
  • Fix: check if $terms before proceeding with foreach in check_item_for_giftwrap_cat method
  • Fix: if admin doesn’t want to show wrap link in cart, also don’t show it on order confirmation page
  • Tweak: If detect Bootstrap modal already, don’t load it again
  • Tweak: Remove redundant use of ‘woocommerce_add_cart_item_data’ hook
  • Tweak: Use new Woo action hooks to move wrap outside cart form, negating need for templates modal-coupon.php and modal-coupon-header.php
  • Tweak: Add sanitization (replacing _e with esc_html_e where appropriate) throughout
  • Tweak: add “none” selection for multiselect on cart/checkout settings page, as default (no location desired)
  • Tweak: error notice for if admin hasn’t set wrap category yet
  • Update translation files
  • Testing with WooCommerce 3.7