Category: Hooks and Filters

  • WooCommerce Checkout Fields and Uploads

    WooCommerce Checkout Fields and Uploads

    If you’re running a WooCommerce payment gateway for your project but you find that you need to add some additional fields to the checkout to keep your client happy, or indeed to placate some law in whichever random country takes their fancy to change the rules of engagement. Of course you could add one of…

  • WooCommerce >= 3.XX Gallery Lightbox Features

    For those of you who remember the little check box on the Woocommerce display settings page, well if you haven’t looked for a while, it is no longer there to make you feel warm and fluffy.

  • woocommerce_process_shop_coupon_meta

    This is the filter that is responsible for saving your field data for the coupon. [php] function webdav_newcoupon_save_data( $post_id ) { $newcoupon_fields = array ( // Your fields should be listed here as an array of // strings. ); foreach ($newcoupon_fields as $field) { $value = isset($_POST[ $field ]) ? $_POST[ $field ] : ”;…

  • woocommerce_coupon_data_panels

    This is the contents of the options panel and where you will list all of your fields to display and how they will be displayed. [php] function webdav_newcoupon_data_panels() { global $woocommerce, $post; echo ‘<div id="webdav_newcoupon_data" class="panel woocommerce_options_panel">’; // Your coupon type options will go in here echo ‘</div>’; } add_action(‘woocommerce_coupon_data_panels’, ‘webdav_newcoupon_data_panels’); [/php]

  • woocommerce_coupon_data_tabs

    This is for creating a tab panel in the admin coupon screen when creating a new coupon. [php] function webdav_newcoupon_data_tabs( $tabs ) { $tabs[‘webdav_newcoupon_data’] = array( ‘label’  => __( ‘WebDav Coupon’, ‘webdav-coupon-plugin’ ), ‘target’ => ‘webdav_newcoupon_data’, ‘class’  => ‘webdav_newcoupon_data’ ); return $tabs; } add_filter( ‘woocommerce_coupon_data_tabs’, ‘webdav_newcoupon_data_tabs’, 100, 1 ); [/php]  

  • woocommerce_coupon_discount_types

    Intercept the coupon types and do what you will, add or remove as you see fit. [php] <?php function webdav_newcoupon_type ($discount_types) { // Custom Code here return $discount_types; } add_filter (‘woocommerce_coupon_discount_types’, ‘webdav_newcoupon_type’, 10, 1); ?> [/php]

  • get_product_search_form

    The filter used for intercepting the default WooCommerce product search form. Assigning a new function to this filter allows the search form to be redesigned to specific requirements [php]<?php function webdav_get_product_search_form () { // Insert custom code here $output = ”; // function should return html code in a string return $output; } add_filter (‘get_product_search_form’,…