开发者 |
littlepackage
cagdasdag wpcenter |
---|---|
更新时间 | 2024年11月21日 21:37 |
PHP版本: | 7.4 及以上 |
WordPress版本: | 6.7 |
版权: | GPLv3 or later |
Things to check:
do_action('woocommerce_before_cart');
or
do_action('woocommerce_before_cart_collaterals');
or
do_action('woocommerce_after_cart');
or
6a. 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 or TwentyTwentyTwo theme and disable all plugins except WooCommerce & Gift Wrapper to rule out theme/plugin interference.
Gift Wrapper Plus (paid upgrade) allows for easy additional hook placements - just type in the name of the hook you want used.
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. Finally, check your browser console for JavaScript errors. This plugin uses JavaScript and sometimes depends sometimes other plugins' broken JavaScript can interfere with ours.
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.
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.
Yes, use the 'wcgiftwrap_change_thumbnail' hook in your (child) theme functions.php file as follows:
function my_custom_thumbnail_size( $thumbnail ) { $thumbnail = 'medium'; // default WP sizes are 'thumb', 'medium', 'medium_large', and 'large' 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. You can also use an image size slug created by an active plugin or theme. If thumbnails do not show in your size afterward, it's possible you need to clear caches or run thumbnail regeneration.
Gift Wrapper Plus (paid upgrade) allows users to set thumbnail size in the settings.
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.
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.
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.
This plugin is heavily CSS-tagged. If you don't want to show a part of what the 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:
.wcgwp-note-container textarea {display: none;}
or
.wcgwp-note {display: none;}
Both lines of CSS should work (version > 6.0). 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 the text "We offer the following gift wrap options:," 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' );
The CSS would be:
.wcgwp-details {display: none;}
You can also adjust the HTML output using the template system built into Gift Wrapper.
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.
Easy, add the following line of code to your (child) theme functions.php file:
add_filter( 'wcgwp_remove_cod_gateway', '__return_true');
Easy. The Plus version of this Gift Wrapper is compatible with the WooCommerce Mix & Match and WooCommerce Composite Products plugins.
There are SO many ways to customize this plugin - all the ways! Your developer will have an easy time customizing this exactly how you want it, using filter hooks, templates and/or string translations.
The PLUS version of this plugin allows for easy string translation by using a settings panel -- just type what you want it to say.
Filter hooks
The easiest option is probably 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 );
Another less specific hook can be used to catch any string. Use the exact original string to match, then replace it:
function my_custom_wrap_strings( $string ) { if ( 'Cancel gift wrap' === $string ) { // Check for default string $string = 'Cancelar envolver regalo'; // Replace default string } else if ( 'Cancel' === $string ) { // Check for default string $string = 'Cancelar'; // Replace default string } else if ( 'Note' === $string ) { // Check for default string $string = 'Nota'; // Replace default string } else if ( 'Note fee' === $string ) { // Check for default string $string = 'Tarifa de nota'; // Replace default string } // etc return $string; } add_filter( 'wcgwp_filter_string', 'wcgwp_filter_strings', 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.
Translation
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 gift-wrapper-en_US.po and putting it in the /lang/ folder inside the Gift Wrapper plugin folder (/wp-content/plugins/gift-wrapper/lang/). If your site is in French (France), your PO file would be /wp-content/plugins/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. Note: translation occurs after filters (mentioned above) are run.
Templating
If you want to do more about styling gift wrap presentation, this plugin includes a templating system.
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.
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. Usually one short line of CSS code can fix this issue. I'd share it here but it hugely depends on which theme you are using.
Learn more about possible theme issues. Gift Wrapper works with many themes, both paid and free, and is offered gratis and as is. Some themes just require very minor tweaking with a line or two of CSS for cooperation. If you have suggestions for how to make it work every time for your theme, we will consider hard-coding in your theme fixes. However, we are not responsible nor for hire to make this plugin work with every theme out there. Thank you for understanding.
Please write for support before leaving negative feedback! Tickets usually get replies within 24-48 hours. This pinned ticket contains solid advice about how to troubleshoot further, and how to request help (to get quick help).
cart_checkout_blocks
feature. This was erroneously declared compatible in 6.1.8, which doesn't necessarily affect function but doesn't reflect the truth. This free plugin is being removed from active development.cart_checkout_blocks
(HPOS) feature