Skip to content

Commit

Permalink
Merge pull request #44 from ramyakrishnai/press4-364
Browse files Browse the repository at this point in the history
Press4 364 || Identify types of products customers are creating
  • Loading branch information
circlecube authored Nov 13, 2023
2 parents 0a09a99 + 347ed84 commit 1199939
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions includes/Listeners/Commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function register_hooks() {
// Paypal Connection
add_filter( 'pre_update_option_yith_ppwc_merchant_data_production', array( $this, 'paypal_connection' ), 10, 2 );
add_filter('update_option_ewc4wp_sso_account_status', array($this, 'ecomdash_connected'));
add_filter( 'woocommerce_update_product', array( $this, 'product_created_or_updated' ), 100, 2 );
}

/**
Expand Down Expand Up @@ -273,4 +274,23 @@ public function ecomdash_connected($new_option, $old_option) {
}
return $new_option;
}

/**
* Product added, send data to Hiive
* @param string $product_id id of post which is being savedPost ObjectOld value of the yith_ppwc_merchant_data_production option
* @param WP_POST $product details of the product
* @return void
*/
public function product_created_or_updated($product_id, $product) {
$data = array(
"label_key" => "product_type",
"product_type" => $product->product_type,
"post_id" => $product_id
);

$this->push(
"product_created",
$data
);
}
}

0 comments on commit 1199939

Please sign in to comment.