WooComerce REST API
-
Woocomerce REST API fails
When I create a product with the REST API with the default language, ej: BOTIN AY1701 in the response I get [:fr]BOTIN AY1701[:]. This also fails if I send [:es]BOTIN AY1701[:], the name value is empty.
Below there is a example url, a post data example and the response
URL
url = ‘products?lang=es’
resposta = wcapi.post(url, data)
POST data
{‘type’: ‘variable’, ‘name’: ‘BOTIN AY1701’, ‘attributes’: [{‘variation’: True, ‘visible’: True, ‘id’: 3, ‘options’: [‘OCRE01’]}, {‘variation’: True, ‘visible’: True, ‘id’: 4, ‘options’: [’52’, ’40’]}], ‘categories’: [{‘id’: 304}], ‘sku’: ‘AY1701’}
Response
{‘_links’: {‘collection’: [{‘href’: ‘https://devel-lxc.local:81/botiga/wp-json/wc/v2/products’}],
‘self’: [{‘href’: ‘https://devel-lxc.local:81/botiga/wp-json/wc/v2/products/2242’}]},
‘attributes’: [{‘id’: 3,
‘name’: ‘Color’,
‘options’: [‘OCRE01’],
‘position’: 0,
‘variation’: True,
‘visible’: True},
{‘id’: 4,
‘name’: ‘Talla’,
‘options’: [’40’, ’52’],
‘position’: 0,
‘variation’: True,
‘visible’: True}],
‘average_rating’: ‘0’,
‘backordered’: False,
‘backorders’: ‘no’,
‘backorders_allowed’: False,
‘button_text’: ”,
‘catalog_visibility’: ‘visible’,
‘categories’: [{‘id’: 304,
‘name’: ‘BOTIN ESPECIAL’,
‘slug’: ‘botin-especial’}],
‘cross_sell_ids’: [],
‘date_created’: ‘2018-01-20T19:21:39’,
‘date_created_gmt’: ‘2018-01-20T18:21:39’,
‘date_modified’: ‘2018-01-20T19:21:39’,
‘date_modified_gmt’: ‘2018-01-20T18:21:39’,
‘date_on_sale_from’: None,
‘date_on_sale_from_gmt’: None,
‘date_on_sale_to’: None,
‘date_on_sale_to_gmt’: None,
‘default_attributes’: [],
‘description’: ”,
‘dimensions’: {‘height’: ”, ‘length’: ”, ‘width’: ”},
‘download_expiry’: -1,
‘download_limit’: -1,
‘downloadable’: False,
‘downloads’: [],
‘external_url’: ”,
‘featured’: False,
‘grouped_products’: [],
‘id’: 2242,
‘images’: [{‘alt’: ‘Marcador’,
‘date_created’: ‘2018-01-20T19:21:40’,
‘date_created_gmt’: ‘2018-01-20T18:21:40’,
‘date_modified’: ‘2018-01-20T19:21:40’,
‘date_modified_gmt’: ‘2018-01-20T18:21:40’,
‘id’: 0,
‘name’: ‘Marcador’,
‘position’: 0,
‘src’: ‘https://devel-lxc.local:81/botiga/wp-content/plugins/woocommerce/assets/images/placeholder.png’}],
‘in_stock’: False,
‘manage_stock’: False,
‘menu_order’: 0,
‘meta_data’: [],
‘name’: ‘[:fr]BOTIN AY1701[:]’,
‘on_sale’: False,
‘parent_id’: 0,
‘permalink’: ‘https://devel-lxc.local:81/botiga/producto/botin-ay1701/’,
‘price’: ”,
‘price_html’: ”,
‘purchasable’: False,
‘purchase_note’: ”,
‘rating_count’: 0,
‘regular_price’: ”,
‘related_ids’: [],
‘reviews_allowed’: True,
‘sale_price’: ”,
‘shipping_class’: ”,
‘shipping_class_id’: 0,
‘shipping_required’: True,
‘shipping_taxable’: True,
‘short_description’: ”,
‘sku’: ‘AY1701’,
‘slug’: ‘botin-ay1701’,
‘sold_individually’: False,
‘status’: ‘publish’,
‘stock_quantity’: None,
‘tags’: [],
‘tax_class’: ”,
‘tax_status’: ‘taxable’,
‘total_sales’: 0,
‘type’: ‘variable’,
‘upsell_ids’: [],
‘variations’: [],
‘virtual’: False,
‘weight’: ”}
- The topic ‘WooComerce REST API’ is closed to new replies.