Programming (Actions and Filters)

Table of Contents

This plugin gives you the possibility to customize and modify different parts of the the programming code. Similar to other plugins, we use actions and filters for this:

Action hooks #

includes/wc-product-serialnumber-functions.php

// Product Serialnumber Created
do_action( 'wc_product_serialnumber_created', $post_id );

// Product Serialnumber Before saving Post
do_action( 'wc_product_serialnumber_save_post', $post_id );

// Product Serialnumber Item before it gets deleted
do_action( 'woocommerce_before_delete_product_serialnumber_item', $item_id );

// Product Serialnumber Item delete
do_action( 'woocommerce_delete_product_serialnumber_item', $item_id );

includes/admin/class-wc-product-serialnumber-admin-meta-boxes.php

// Product Serialnumber Saving the Meta Boxes
do_action( 'woocommerce_save_product_serialnumber_meta_boxes', $post_id, $post );

includes/admin/class-wc-shipment-admin-meta-boxes.php

// Supplier Shipment Saving the Meta Boxes
do_action( 'woocommerce_save_shipment_meta_boxes', $post_id, $post );

includes/admin/meta-boxes/views/html-product-serialnumber-orders.php

// Product Serialnumber add information after billing address
do_action( 'woocommerce_admin_order_data_after_billing_address', $order );

Product Serialnumber add information after shipping address
do_action( 'woocommerce_admin_order_data_after_shipping_address', $order );

includes/admin/meta-boxes/views/html-product-serialnumber-order-item.php

// Product Serialnumber related order item data
do_action( 'woocommerce_admin_order_item_headers', $order );

includes/admin/meta-boxes/class-wc-shipment-meta-box-shipment-data.php

// Supplier Shipment data start
do_action( 'wc_product_serialnumber_meta_box_shipment_data_start', $post, $shipment );

// Supplier Shipment data end
do_action( 'wc_product_serialnumber_meta_box_shipment_data_end', $post, $shipment );

includes/class-wc-product-serialnumber-ajax.php

// Save serialnumber via ajax
do_action( 'woocommerce_product_serialnumber_save_product_serialnumber_ajax', $product_serialnumber, $pl_item_id);

Filter hooks #

includes/admin/meta-boxes/class-wc-product-serialnumber-meta-box-comments.php

// Product Serialnumber Note Class
apply_filters( 'wc_product_serialnumber_note_class', $note_classes, $note );

includes/admin/meta-boxes/class-wc-product-serialnumber-meta-box-tabs.php

// Product Serialnumber Tabs
apply_filters( 'wc_product_serialnumber_tabs', array() );

// Product Tab Title By Key
apply_filters( 'woocommerce_product_' . $key . '_tab_title', esc_html( $tab['title'] ), $key );

includes/admin/meta-boxes/class-wc-shipment-meta-box-comments.php

// Shipment Note Class
apply_filters( 'wc_shipment_note_class', $note_classes, $note );

includes/admin/meta-boxes/class-wc-shipment-meta-box-shipment-data.php

// Product Serialnumber Meta Box Shipment Data Show Created By
apply_filters( 'wc_product_serialnumber_meta_box_shipment_data_show_created_by', true );

// Product Serialnumber Meta Box Shipment Data Show Arrived On
apply_filters( 'wc_product_serialnumber_meta_box_shipment_data_show_arrived_on', true );

// Product Serialnumber Meta Box Shipment Data Arrived On
apply_filters( 'wc_product_serialnumber_meta_box_shipment_data_arrived_on', $arrived_on );

// Date Input HTML Pattern
apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' );

// Product Serialnumber Meta Box Shipment Data Show Registered By
apply_filters( 'wc_product_serialnumber_meta_box_shipment_data_show_registered_by', true );

// Product Serialnumber Meta Box Shipment Data Registered By
apply_filters( 'wc_product_serialnumber_meta_box_shipment_data_registered_by', $registered_by );

// Product Serialnumber Meta Box Shipment Data Roles In
apply_filters( 'wc_product_serialnumber_meta_box_shipment_data_roles_in', $roles_in );

// Product Serialnumber Meta Box Shipment Data Show Supplier Order IDs
apply_filters( 'wc_product_serialnumber_meta_box_shipment_data_show_supplier_order_ids', true );

// Product Serialnumber Meta Box Shipment Data Supplier Order IDs
apply_filters( 'wc_product_serialnumber_meta_box_shipment_data_supplier_order_ids', $supplier_order_ids );

includes/admin/meta-boxes/views/html-product-item.php

// Admin HTML Order Item Class
apply_filters( 'woocommerce_admin_html_order_item_class', ( ! empty( $class ) ? $class : '' ), $product );

// Admin Order Item Thumbnail
apply_filters( 'woocommerce_admin_order_item_thumbnail', $product->get_image( 'shop_thumbnail', array( 'title' => '' ) ), $product_id, $product );

includes/admin/meta-boxes/views/html-product-serialnumber-customer-address.php

// My Account Get Addresses
apply_filters( 'woocommerce_my_account_get_addresses', array( 
   'billing' => __( 'Billing Address', 'woocommerce' ),
   'shipping' => __( 'Shipping Address', 'woocommerce' )
), $customer_id );

includes/admin/meta-boxes/views/html-shipment-supplier.php

// Product Serialnumber Meta Box Shipment Supplier Roles In
apply_filters( 'wc_product_serialnumber_meta_box_shipment_supplier_roles_in', $roles_in );

includes/class-wc-product-serialnumber-ajax.php

// Product Serialnumber Save Product Serialnumber Ajax Parent
apply_filters( 'woocommerce_product_serialnumber_save_product_serialnumber_ajax_parent', $parent_id, $product_serialnumber, $order_item_id);

// JSON Search Found Items
apply_filters( 'woocommerce_json_search_found_items', $found_items );

includes/class-wc-product-serialnumber-product-serialnumber.php

// Product Serialnumber New Note Data
apply_filters( 'woocommerce_product_serialnumber_new_note_data', compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_agent', 'comment_type', 'comment_parent', 'comment_approved' ), $this->id );

includes/class-wc-product-serialnumber-shipment.php

// Product Serialnumber New Note Data
apply_filters( 'woocommerce_product_serialnumber_new_note_data', compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_agent', 'comment_type', 'comment_parent', 'comment_approved' ), $this->id );

includes/wc-product-serialnumber-functions.php

// Product Serialnumber Statuses
apply_filters( 'wc_product_serialnumber_statuses', $product_serialnumber_statuses );

// Product Serialnumber Default Supplier ID
apply_filters( 'wc_product_serialnumber_default_supplier_id', $supplier_id );