{"id":51760,"date":"2016-10-27T11:58:45","date_gmt":"2016-10-27T11:58:45","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/wc-gift-packaging\/"},"modified":"2019-07-30T10:03:50","modified_gmt":"2019-07-30T10:03:50","slug":"wc-gift-packaging","status":"publish","type":"plugin","link":"https:\/\/pcd.wordpress.org\/plugins\/wc-gift-packaging\/","author":10496251,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.5","stable_tag":"1.5","tested":"5.2.24","requires":"3.0","requires_php":"","requires_plugins":"","header_name":"WC Gift Packaging","header_author":"","header_description":"","assets_banners_color":"","last_updated":"2019-07-30 10:03:50","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"","rating":4.7,"author_block_rating":0,"active_installs":100,"downloads":5104,"num_ratings":3,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":1,"5":2},"assets_icons":{"icon.svg":{"filename":"icon.svg","revision":"2130677","resolution":"","location":"assets","locale":""}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.1","1.2","1.3","1.4","1.5"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[3148,13486,125587,286,125588],"plugin_category":[],"plugin_contributors":[94942,94941],"plugin_business_model":[],"class_list":["post-51760","plugin","type-plugin","status-publish","hentry","plugin_tags-checkout","plugin_tags-gift","plugin_tags-packaging","plugin_tags-woocommerce","plugin_tags-wrapping","plugin_contributors-fouadvollmer","plugin_contributors-grandy","plugin_committers-grandy"],"banners":[],"icons":{"svg":"https:\/\/ps.w.org\/wc-gift-packaging\/assets\/icon.svg?rev=2130677","icon":"https:\/\/ps.w.org\/wc-gift-packaging\/assets\/icon.svg?rev=2130677","icon_2x":false,"generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Add a simple \"Send this order packaged as gift\" checkbox to the checkout. Optionally it is possible to set a price for the packaging.<\/p>\n\n<p>If you want multiple gift packagings and other fancy stuff this is not the plugin for you \u2026 this plugin is intentionally very lightweight to fit directly into the WooCommerce user experience.<\/p>\n\n<!--section=installation-->\n<p>Here's how to install the plugin:<\/p>\n\n<ol>\n<li>Upload 'woocommerce-gift-options' to the '\/wp-content\/plugins\/' directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Go to WordPress Admin &gt; WooCommerce &gt; Settings &gt; Checkout and set the 'Gift packaging cost' field if you want to charge something for the packaging<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>Is it possible to add a price for the packaging<\/dt>\n<dd><p>Yes. You can change this under Woocommerce &gt; Settings &gt; General &gt; WC Gift Packaging in the 'Gift packaging cost' field.<\/p><\/dd>\n<dt>Is it possible to change the position of the checkbox<\/dt>\n<dd><p>Yes. You can change the hook of the checkbox like this:<\/p>\n\n<pre><code>add_filter( 'wc_gift_packaging_field_hook', 'custom_hook_position' );\n\nfunction custom_hook_position( $text ) {\n\n    return 'woocommerce_after_order_notes';\n\n}\n<\/code><\/pre><\/dd>\n<dt>Is it possible to change the text of the checkbox<\/dt>\n<dd><p>Yes. You can change the text of the checkbox with the <code>wc_gift_packaging_checkout_field<\/code> filter:<\/p>\n\n<pre><code>add_filter( 'wc_gift_packaging_checkout_field', 'my_checkbox_text' );\n\nfunction my_checkbox_text( $text ) {\n\n    return __( \"Send this order as awesome packaged gift\" );\n\n}\n<\/code><\/pre><\/dd>\n<dt>Is it possible to wrap the checkbox in some html<\/dt>\n<dd><p>Yes. You can use the <code>before_wc_gift_packaging_checkout_field<\/code> and <code>after_wc_gift_packaging_checkout_field<\/code> hooks like this:<\/p>\n\n<pre><code>add_action( 'before_wc_gift_packaging_checkout_field', 'custom_start' );\n\nfunction custom_start() {\n\n    echo '&lt;div class=\"my-custom-html\"&gt;';\n\n}\n\nadd_action( 'after_wc_gift_packaging_checkout_field', 'custom_end' );\n\nfunction custom_end() {\n\n    echo '&lt;\/div&gt;';\n\n}\n<\/code><\/pre><\/dd>\n<dt>Is it possible to customize the note in the mail, order details or backend<\/dt>\n<dd><p>Yes. You can use the <code>wc_gift_packaging_admin_note<\/code>, <code>wc_gift_packaging_order_note<\/code> or <code>wc_gift_packaging_email_note<\/code> filters to completely change the note. Here are two examples:<\/p>\n\n<pre><code>add_filter( 'wc_gift_packaging_admin_note', 'custom_note', 10, 2 );\n\nfunction custom_note( $text, $is_gift ) {\n\n    if( $is_gift ):\n\n        return '&lt;h3&gt;' . __( \"This is a regular order\" ) . '&lt;\/h3&gt;';\n\n    else:\n\n        return '&lt;h3&gt;' . __( \"This order is a gift\" ) . '&lt;\/h3&gt;';\n\n    endif;\n\n\n}\n\n\nadd_filter( 'wc_gift_packaging_order_note', 'html_wrap', 10, 2 );\n\nfunction html_wrap( $text, $is_gift ) {\n\n    return '&lt;div class=\"my-custom-html\"&gt;' . $text . '&lt;\/div&gt;';\n\n\n}\n<\/code><\/pre><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.5<\/h4>\n\n<ul>\n<li>The price setting is now visible again under Woocommerce &gt; Settings &gt; General in the WC Gift Packaging section<\/li>\n<\/ul>\n\n<h4>1.4<\/h4>\n\n<ul>\n<li>Updated plugin information<\/li>\n<\/ul>\n\n<h4>1.3<\/h4>\n\n<ul>\n<li>Bugfix that removes a PHP-Undefined-Index-Notice<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>Bugfix that changes <code>$order-&gt;id<\/code> to <code>$order-&gt;get_order_number()<\/code><\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>Bugfix wich makes the <code>$checkout<\/code> parameter in the <code>wc_gift_packaging_field<\/code> function optional to allows the usage of more hooks <\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"This plugin adds a &#039;Send this order packaged as gift&#039; option on the WooCommerce checkout.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/51760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=51760"}],"author":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/grandy"}],"wp:attachment":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=51760"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=51760"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=51760"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=51760"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=51760"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=51760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}