Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncs product with name in ALL CAPS and displays warning #2589

Merged
merged 6 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions includes/Admin/Product_Sync_Meta_Box.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public static function output() {

<?php endif; ?>

<?php endif; ?>

<?php if ( \WC_Facebookcommerce_Utils::is_all_caps( $fb_product->get_title() ) ) : ?>
<p><b><?php echo esc_html__( 'Product title in all capital letters can lead to the server rejecting the product. To ensure successful product synchronization, please convert the product title to a sentence case.', 'facebook-for-woocommerce' ); ?></b></p>

<?php endif; ?>

<input name="is_product_page" type="hidden" value="1"/>
Expand Down
4 changes: 0 additions & 4 deletions includes/ProductSync/ProductValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,8 @@ protected function validate_product_title() {

/*
* Requirements:
* - No all caps title.
* - Max length 150.
*/
if ( \WC_Facebookcommerce_Utils::is_all_caps( $title ) ) {
throw new ProductInvalidException( __( 'Product title is all capital letters. Please change the title to sentence case in order to allow synchronization of your product.', 'facebook-for-woocommerce' ) );
}
if ( mb_strlen( $title, 'UTF-8' ) > self::MAX_TITLE_LENGTH ) {
throw new ProductInvalidException( __( 'Product title is too long. Maximum allowed length is 150 characters.', 'facebook-for-woocommerce' ) );
}
Expand Down