php - WooCommerce api attribute hooks -


goodmorning,

i have question regarding woocommerce, api more specific. woocommerce has few actions use actions (not relevant anyway). hooks fire long attribute created in wp-admin. when attribute added through use of api hooks not fire. not know if intended or how api avoids using default woocommerce functionality of adding , deleting attributes there work around?

i did same terms, use default wordpress hooks create_term , delete_term for. same of products save_post_product. hooks attributes woocommerce hooks not sure if there alternate approach.

my class:

<?php /**  * @author: berend de groot  * @date: 1-8-17  * @time: 13:57  */ defined('abspath') or exit;  class woocommerceattribute {     const attr_type = "attribute";     protected static $instance;       public static function init() {         is_null(self::$instance) , self::$instance == new self;         return self::$instance;     }       public function __construct() {         add_action("woocommerce_attribute_added", array("woocommerceattribute", "saveattribute"), 10, 2);         add_action("woocommerce_attribute_deleted", array("woocommerceattribute", "deleteattribute"), 10, 3);     }      /**      * @param $insert_id      * @param $attribute      */     public static function saveattribute($insert_id, $attribute) {             woocommerceparentobject::saveparentobject($insert_id);     }      /**      * @param      $attribute_id      * @param null $attribute_name      * @param null $taxonomy      */     public static function deleteattribute($attribute_id, $attribute_name = null , $taxonomy = null) {         if(woocommerceparentobject::isfromparent($attribute_id))         {             woocommerceparentobject::deleteparentobject($attribute_id);         }     } } 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -