• Resolved dale3h

    (@dale3h)


    Please add the ability to disable name and description syncing from Square to WooCommerce. I have already patched my local copy of the plugin, but the next update will overwrite my changes:

    In file woocommerce-square/includes/Handlers/Product.php:

    Change from:

    
    $variation->set_name( $catalog_variation->getItemVariationData()->getName() );
    

    to:

    
    $variation_name = apply_filters( 'wc_square_product_set_variation_name', $catalog_variation->getItemVariationData()->getName() );
    if ( $variation_name ) {
        $variation->set_name( $variation_name );
    }
    

    And change from:

    
    $product->set_name( wc_clean( $catalog_item->getName() ) );
    $product->set_description( $catalog_item->getDescription() );
    

    to:

    
    $product_name = apply_filters( 'wc_square_product_set_product_name', $catalog_item->getName() );
    if ( $product_name ) {
        $product->set_name( wc_clean( $product_name ) );
    }
    
    $product_description = apply_filters( 'wc_square_product_set_product_description', $catalog_item->getDescription() );
    if ( $product_description ) {
        $product->set_description( $product_description );
    }
    

    These changes will allow disabling (or modifying) the name and/or description with simple filter hooks. Here is an example to disable name and description (add to functions.php):

    
    add_filter( 'wc_square_product_set_variation_name', function( $variation_name ) {
        return false;
    } );
    
    add_filter( 'wc_square_product_set_product_name', function( $product_name ) {
        return false;
    } );
    
    add_filter( 'wc_square_product_set_product_description', function( $product_description ) {
        return false;
    } );
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Ability to disable name/description syncing’ is closed to new replies.