ct_hash']['id'] ]['price']['passed_check'] = 'no'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['price']['notification'] = 'Your product price is empty, make sure to add a price to all your products.'; } $separator = wc_get_price_decimal_separator(); if ( $separator == '.' ) { if ( ! is_numeric( $product_data['price'] ) ) { $gs_analysis_check[ $product_data['project_hash']['id'] ]['price']['passed_check'] = 'no'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['price']['notification'] = "Your product price ($product_price) doesn't appear to be a valid price."; } } if ( empty( $product_data['price'] ) ) { $gs_analysis_check[ $product_data['project_hash']['id'] ]['price']['passed_check'] = 'no'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['price']['notification'] = "Your product price ($product_price) doesn't appear to be a valid price, it cannot be empty of 0 (zero)"; } if ( $product_data['price'] == '0,00' ) { $gs_analysis_check[ $product_data['project_hash']['id'] ]['price']['passed_check'] = 'no'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['price']['notification'] = "Your product price ($product_price) doesn't appear to be a valid price, it cannot be empty of 0 (zero)"; } // Product type $length_product_type = strlen( $product_data['product_type'] ); $product_type = $product_data['product_type']; $gs_analysis_check[ $product_data['project_hash']['id'] ]['product_type']['length'] = $length_price; $gs_analysis_check[ $product_data['project_hash']['id'] ]['product_type']['more_information'] = 'https://support.google.com/merchants/answer/6324406'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['product_type']['passed_check'] = 'yes'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['product_type']['notification'] = "Your product type meets Google's requirements."; if ( $length_product_type > 750 ) { $gs_analysis_check[ $product_data['project_hash']['id'] ]['product_type']['passed_check'] = 'no'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['product_type']['notification'] = 'Your product type value is too long, make sure it is no longer than 750 characters.'; } elseif ( $length_product_type < 1 ) { $gs_analysis_check[ $product_data['project_hash']['id'] ]['product_type']['passed_check'] = 'no'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['product_type']['notification'] = 'Your product type field is empty.'; } else { } // Condition $gs_analysis_check[ $product_data['project_hash']['id'] ]['condition']['more_information'] = 'https://support.google.com/merchants/answer/6324469'; $condition_allowed = array( 'new', 'refurbished', 'used', 'New', 'Refurbished', 'Used' ); $condition = $product_data['condition']; if ( ! in_array( $product_data['condition'], $condition_allowed ) ) { $gs_analysis_check[ $product_data['project_hash']['id'] ]['condition']['passed_check'] = 'no'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['condition']['notification'] = "Your condition value ($condition) does not meet Google's requirements (make sure the value is new, refurbished or used)."; } else { $gs_analysis_check[ $product_data['project_hash']['id'] ]['condition']['passed_check'] = 'yes'; $gs_analysis_check[ $product_data['project_hash']['id'] ]['condition']['notification'] = "Your condition value ($condition) meets Google's requirements, well done!"; } // Save Google Shopping analysis results update_option( 'woosea_gs_analysis_results', $gs_analysis_check, false ); } }