Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function change_stage( $deal_id, $stage ) {
- $pipeline_stage = explode( '+', $stage );
- $deal = array(
- 'properties' => array(
- array(
- 'name' => 'pipeline',
- 'value' => $pipeline_stage[0],
- ),
- array(
- 'name' => 'dealstage',
- 'value' => $pipeline_stage[1],
- ),
- ),
- );
- $params = wp_fusion()->crm->get_params();
- /**
- * Filters the deal when changing the stage.
- *
- * @since 1.17.9
- *
- * @param array $deal The deal data.
- * @param int $deal_id The deal ID to be updated.
- */
- $deal = apply_filters( 'wpf_ecommerce_hubspot_change_deal_stage', $deal, $deal_id );
- $params['body'] = json_encode( $deal );
- $params['method'] = 'PUT';
- $response = wp_remote_request( 'https://api.hubapi.com/deals/v1/deal/' . $deal_id, $params );
- if ( is_wp_error( $response ) ) {
- return $response;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement