-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #40 from sumathi3399/PRESS4-360-events-data
PRESS4-360 | Events data
- Loading branch information
Showing
4 changed files
with
169 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace NewfoldLabs\WP\Module\Data\Listeners; | ||
|
||
/** | ||
* Monitors WonderCart events | ||
*/ | ||
class WonderCart extends Listener { | ||
|
||
/** | ||
* Register the hooks for the listener | ||
* | ||
* @return void | ||
*/ | ||
public function register_hooks() { | ||
add_action('rest_after_insert_yith_campaign', array( $this, 'register_campaign' ), 10 ); | ||
} | ||
|
||
/** | ||
* Campaign created | ||
* | ||
* @param string $post | ||
* | ||
* @return string The post value | ||
*/ | ||
public function register_campaign( $post){ | ||
$campaign = yith_sales_get_campaign( $post->ID ); | ||
if ($campaign){ | ||
$type = $campaign->get_type(); | ||
|
||
$data = array( | ||
"label_key"=> "type", | ||
"type"=> $type, | ||
); | ||
|
||
$this->push( | ||
"campaign_created", | ||
$data | ||
); | ||
} | ||
|
||
return $post; | ||
} | ||
} |
Oops, something went wrong.