attributes ) { $attributes = $config->attributes; } if ( ! $attributes ) { return $output; } $key = array_search( $product_attribute, $attributes, true ); // ! empty( $key ) this condition is removed because it is not working for 0 index. if ( isset( $config->suffix ) && array_key_exists( $key, $config->suffix ) ) { $unit = $config->suffix[ $key ]; if ( ! empty( $unit ) && ! empty( $output ) ) { $output .= ' ' . $unit; } elseif ( ! empty( $wc_unit ) && ! empty( $output ) ) { $output .= $wc_unit; } } return $output; } /** * Google Shopping Product Description Character limit: max 5000. * * @param string $description product description. * @return string * @link https://webappick.atlassian.net/browse/CBT-150 */ public function woo_feed_filter_product_description_callback( $description ) { return is_null( $description ) ? '' : substr($description, 0, 5000); } /** * Modify product title for google merchant. * * @param string $title product title. * @return string */ public function woo_feed_filter_product_title_callback( $title ) { // Google Shopping Product Title Character limit: max 150. $title = mb_substr($title, 0, 150, 'UTF-8'); return $title; } /** * Set (-) as separator for this merchant. * * @param $separator string attribute separator. * * @return string */ public function woo_feed_attribute_separator_callback( $separator ) { return ' - '; } /** * Set (_) as separator for google merchant. * * @param string $status product start. * @return string */ public function woo_feed_filter_product_availability_callback( $status ) { $status = explode( ' ', $status ); $status = implode( '_', $status ); return $status; } /** * Modify product availability date. * * @param string $availability_date availability date. * @return string */ public function woo_feed_filter_product_availability_date_callback( $availability_date ) { return gmdate( 'c', strtotime( $availability_date ) ); } }