Title: Attributes being truncated when using API
Last modified: May 23, 2022

---

# Attributes being truncated when using API

 *  Resolved [arhamm](https://wordpress.org/support/users/arhamm/)
 * (@arhamm)
 * [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/)
 * Hello,
 * I’m using the Woocommerce API to list my products.
 * I’m having an issue with one of my attributes, “Model”.
 * The value I want to use for my “Model” attribute is “D5600 32GB”.
 * Every time I list using the API instead of “D5600 32GB” there are two values,
   one is “D5600” and the other is “32GB”.
 * How can I stop it from truncating the values of my attributes?

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

 *  Plugin Support [Kaushik S. a11n](https://wordpress.org/support/users/kaushiksomaiya/)
 * (@kaushiksomaiya)
 * [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/#post-15670009)
 * Hi there!
 * Thanks for contacting us. 🙂
 * I understand you are trying to list the products via WooCommerce Rest API but
   the attributes are breaking up into two when they have a space.
 * Could you share details of the request you are making and the JSON response that
   you get?
 * Also, could you show us the code you are using to display the products?
 * I did some tests using the `/wp-json/wc/v3/products` endpoint but I wasn’t able
   to reproduce this issue. The attributes returned correctly without breaking up.
 *  Thread Starter [arhamm](https://wordpress.org/support/users/arhamm/)
 * (@arhamm)
 * [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/#post-15677136)
 * Thank you for getting back to me.
 * Here is the request I’m making:
 *     ```
       curl -X POST https://domain/wp-json/wc/v3/products \
           -u ck:cs \
           -H "Content-Type: application/json" \
           -d '{
         "name": "Premium Quality",
         "type": "simple",
         "regular_price": "21.99",
         "description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
         "short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
         "categories": [
           {
             "id": 9
           },
           {
             "id": 14
           }
         ],
           "attributes": [
           {
       	  "name": "Model",
       	  "options": "D5600 32GB"
       	}
          ],
         "images": [
           {
             "src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg"
           },
           {
             "src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg"
           }
         ]
       }'
       ```
   
 * Here is the response I’m getting
 *     ```
       {
          "id":9393,
          "name":"Premium Quality",
          "slug":"premium-quality-4",
          "permalink":"https:\/\/domain\/product\/premium-quality-4\/",
          "date_created":"2022-05-25T11:40:28",
          "date_created_gmt":"2022-05-25T10:40:28",
          "date_modified":"2022-05-25T11:40:28",
          "date_modified_gmt":"2022-05-25T10:40:28",
          "type":"simple",
          "status":"publish",
          "featured":false,
          "catalog_visibility":"visible",
          "description":"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
          "short_description":"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
          "sku":"",
          "price":"21.99",
          "regular_price":"21.99",
          "sale_price":"",
          "date_on_sale_from":null,
          "date_on_sale_from_gmt":null,
          "date_on_sale_to":null,
          "date_on_sale_to_gmt":null,
          "on_sale":false,
          "purchasable":true,
          "total_sales":0,
          "virtual":false,
          "downloadable":false,
          "downloads":[
   
          ],
          "download_limit":-1,
          "download_expiry":-1,
          "external_url":"",
          "button_text":"",
          "tax_status":"taxable",
          "tax_class":"",
          "manage_stock":false,
          "stock_quantity":null,
          "backorders":"no",
          "backorders_allowed":false,
          "backordered":false,
          "low_stock_amount":null,
          "sold_individually":false,
          "weight":"",
          "dimensions":{
             "length":"",
             "width":"",
             "height":""
          },
          "shipping_required":true,
          "shipping_taxable":true,
          "shipping_class":"",
          "shipping_class_id":0,
          "reviews_allowed":true,
          "average_rating":"0",
          "rating_count":0,
          "upsell_ids":[
   
          ],
          "cross_sell_ids":[
   
          ],
          "parent_id":0,
          "purchase_note":"",
          "categories":[
             {
                "id":15,
                "name":"Uncategorized",
                "slug":"uncategorized"
             }
          ],
          "tags":[
   
          ],
          "images":[
             {
                "id":9391,
                "date_created":"2022-05-25T12:40:28",
                "date_created_gmt":"2022-05-25T10:40:28",
                "date_modified":"2022-05-25T12:40:28",
                "date_modified_gmt":"2022-05-25T10:40:28",
                "src":"https:\/\/domain.co.uk\/wp-content\/uploads\/2022\/05\/T_2_front-3.jpg",
                "name":"T_2_front-3.jpg",
                "alt":""
             },
             {
                "id":9392,
                "date_created":"2022-05-25T12:40:28",
                "date_created_gmt":"2022-05-25T10:40:28",
                "date_modified":"2022-05-25T12:40:28",
                "date_modified_gmt":"2022-05-25T10:40:28",
                "src":"https:\/\/domain.co.uk\/wp-content\/uploads\/2022\/05\/T_2_back-3.jpg",
                "name":"T_2_back-3.jpg",
                "alt":""
             }
          ],
          "attributes":[
             {
                "id":0,
                "name":"Model",
                "position":0,
                "visible":false,
                "variation":false,
                "options":[
                   "D5600",
                   "32GB"
                ]
             }
          ],
          "default_attributes":[
   
          ],
          "variations":[
   
          ],
          "grouped_products":[
   
          ],
          "menu_order":0,
          "price_html":"<span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&pound;<\/span>21.99<\/bdi><\/span>",
          "related_ids":[
             6409,
             4527,
             6264,
             9390,
             9387
          ],
          "meta_data":[
   
          ],
          "stock_status":"instock",
          "has_options":false,
          "_links":{
             "self":[
                {
                   "href":"https:\/\/domain.co.uk\/wp-json\/wc\/v3\/products\/9393"
                }
             ],
             "collection":[
                {
                   "href":"https:\/\/domain.co.uk\/wp-json\/wc\/v3\/products"
                }
             ]
          }
       }
       ```
   
 * For now I’m looking at the products from the backend and I can see two options
   instead of the only one I’m submitting
 * Thanks again
    -  This reply was modified 4 years ago by [arhamm](https://wordpress.org/support/users/arhamm/).
    -  This reply was modified 4 years ago by [arhamm](https://wordpress.org/support/users/arhamm/).
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/#post-15678403)
 * Hi [@arhamm](https://wordpress.org/support/users/arhamm/),
 * Thanks for sharing the request and the JSON response.
 * I see what you mean with the separate values.
 * ![](https://i0.wp.com/snipboard.io/JkhHFD.jpg?ssl=1)
 * I wasn’t able to reproduce the issue though same as Kaushik mentioned earlier.
 * ![](https://i0.wp.com/i.imgur.com/cnWTzdf.png?ssl=1)
 * Can you try with all plugins disabled (except WooCommerce) and with a default
   theme like Storefront? Also, make sure you’re sending a `GET` HTTP request as
   per support documentation.
 * [https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products](https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products)
 * Let us know how it goes.
 *  [limabu](https://wordpress.org/support/users/limabu/)
 * (@limabu)
 * [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/#post-15681710)
 * We had the same issue. You have to send the options in an array.
    You’re missing
   the [] – characters which need to embrace your “D5600 32GB”. I hope this helps!
 * See example down below:
 *  “attributes”: [
    { “name”: “COLORE”, “position”: 0, “visible”: false, “variation”:
   true, “options”: [ “Black Blue” ]
 *  }
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/#post-15681981)
 * Hi [@limabu](https://wordpress.org/support/users/limabu/),
 * Thanks so much for your comment on this thread.
 * [@arhamm](https://wordpress.org/support/users/arhamm/) can you try adding [ ]
   square brackets and see if it works? You can see that those brackets are also
   shown in the image I shared above for the Model attribute value.
 * Best.
 *  Thread Starter [arhamm](https://wordpress.org/support/users/arhamm/)
 * (@arhamm)
 * [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/#post-15683015)
 * Hi [@limabu](https://wordpress.org/support/users/limabu/)
 * You are right, that fixed my issue.
 * Thanks and thank you [@rainfallnixfig](https://wordpress.org/support/users/rainfallnixfig/)
   [@kaushiksomaiya](https://wordpress.org/support/users/kaushiksomaiya/) for helping
 * Regards
 *  [aetta](https://wordpress.org/support/users/chiape/)
 * (@chiape)
 * [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/#post-15683091)
 * Hi [@arhamm](https://wordpress.org/support/users/arhamm/)!
 * We’re happy to hear that! I’m going to mark this as resolved, but feel free to
   create a new topic if you need anything else!
 * All the best!

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

The topic ‘Attributes being truncated when using API’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 7 replies
 * 5 participants
 * Last reply from: [aetta](https://wordpress.org/support/users/chiape/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/attributes-being-truncated-when-using-api/#post-15683091)
 * Status: resolved