Title: jonathan66's Replies | WordPress.org

---

# jonathan66

  [  ](https://wordpress.org/support/users/jonathan66/)

 *   [Profile](https://wordpress.org/support/users/jonathan66/)
 *   [Topics Started](https://wordpress.org/support/users/jonathan66/topics/)
 *   [Replies Created](https://wordpress.org/support/users/jonathan66/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/jonathan66/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/jonathan66/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/jonathan66/engagements/)
 *   [Favorites](https://wordpress.org/support/users/jonathan66/favorites/)

 Search replies:

## Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPC Composite Products for WooCommerce] Error UGS / ID](https://wordpress.org/support/topic/error-ugs-id/)
 *  Thread Starter [jonathan66](https://wordpress.org/support/users/jonathan66/)
 * (@jonathan66)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-ugs-id/#post-18491215)
 * Correction :
 * $product_id = wc_get_product_id_by_sku( $component[‘default’] );
   $product_default
   = wc_get_product( $product_id );
    -  This reply was modified 1 year, 4 months ago by [jonathan66](https://wordpress.org/support/users/jonathan66/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPC Composite Products for WooCommerce] Error UGS / ID](https://wordpress.org/support/topic/error-ugs-id/)
 *  Thread Starter [jonathan66](https://wordpress.org/support/users/jonathan66/)
 * (@jonathan66)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-ugs-id/#post-18491184)
 * Hello. The difference between UGS and SKU isn’t the issue. Why do you keep talking
   to me about this?Pretend I never mentioned it and let’s get back to the problem.
 *  If SKU (e.g., 602) has an equivalent Product ID (e.g., 602), then Problem.
 * Can you check this piece of code please?
 * file : class-woocoo.php line 426
 * if ( ! empty( $component[‘default’] ) ) {
   if ( is_numeric( $component[‘default’])){//
   ← 🚩 Problem HERE!!!!!!!!!!// id$product_default = wc_get_product( $component[‘
   default’] );} else {// sku$product_default = wc_get_product( wc_get_product_id_by_sku(
   $component[‘default’] ) );}
 *     ```wp-block-code
       if ( $product_default ) {
           echo '<option value="' . esc_attr( $component['default'] ) . '" selected="selected">' . wp_kses_post( $product_default->get_formatted_name() ) . '</option>';
       }
       ```
   
 * }
 * `is_numeric()` considers anything that looks like a number (e.g., `"1234"`) as
   a number.
 * So if your SKU is `"1234"` (which is a string of digits), it will pass this test.
 * But WooCommerce will then try to fetch a product using the ID `1234`:
 * `$product_default = wc_get_product( $component['default'] );`
 * … instead of using the function that searches by SKU:
    -  This reply was modified 1 year, 4 months ago by [jonathan66](https://wordpress.org/support/users/jonathan66/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPC Composite Products for WooCommerce] Error UGS / ID](https://wordpress.org/support/topic/error-ugs-id/)
 *  Thread Starter [jonathan66](https://wordpress.org/support/users/jonathan66/)
 * (@jonathan66)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-ugs-id/#post-18483368)
 * Hello.
 *  No, I’m not confusing SKU and SKU. UGS = SKU in French. (See image)
 * [https://imgur.com/a/CAI4hZP](https://imgur.com/a/CAI4hZP)
 * Let’s stick with the word SKU to avoid adding complexity. I’m simply telling 
   you that when I upgrade from version 7.5.4 to 7.5.5, you see BOTH the SKU and
   the product ID. I showed you the proof in my previous images.
 * Pay more attention to the previous images. In the “default option,” I only have
   one product. However, when I look at the smart composite product and the drop-
   down list, a product has been added called “Ph moins piscines… …” even though
   it shouldn’t be there.
 * I’m telling you that its SKU (602), coincidentally, is identical to the ID of
   the product “Tuyau PVC souple…” (602).
 * And I think that’s why I have 2 products when I only need 1.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPC Composite Products for WooCommerce] Error UGS / ID](https://wordpress.org/support/topic/error-ugs-id/)
 *  Thread Starter [jonathan66](https://wordpress.org/support/users/jonathan66/)
 * (@jonathan66)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-ugs-id/#post-18479059)
 * Hello. I’m having trouble importing some images here.
 * Here’s a URL with the images. [https://imgur.com/a/iqacJ3O](https://imgur.com/a/iqacJ3O)
 * I did this with the latest version, 7.5.5. I restored my website when I noticed
   this problem.

Viewing 4 replies - 1 through 4 (of 4 total)