Channel_Synchronizer::handle_name_change( int $term_id )
Summary
If a Channel name is changed, push the change up to the API
Parameters
- $term_id
-
(int) (Required)
Return
(void)
Source
File: src/BigCommerce/Taxonomies/Channel/Channel_Synchronizer.php
public function handle_name_change( $term_id ) { $term = get_term( $term_id ); $channel_id = get_term_meta( $term_id, Channel::CHANNEL_ID, true ); if ( ! $channel_id ) { return; // can't sync if we don't know the identity } $request = new UpdateChannelRequest( [ 'type' => 'storefront', 'platform' => 'wordpress', 'name' => $term->name, ] ); try { $this->channels_api->updateChannel( $channel_id, $request ); } catch ( ApiException $e ) { do_action( 'bigcommerce/log', Error_Log::WARNING, __( 'Error when updating channel name', 'bigcommerce' ), [ 'error' => $e->getMessage(), 'channel_id' => $channel_id, 'name' => $term->name, ] ); do_action( 'bigcommerce/log', Error_Log::DEBUG, $e->getTraceAsString(), [] ); return; } }