REST API & CPT UI
-
Hello,
I’m trying to list the product information with a GET with Postman on /wp-json/wc/v3/products but I don’t see the Taxonomies of products created with Custom Post Type UI.
When I create a new product with a POST the custom taxonomies are missing.My question is: How can I get custom taxonomies to create or update a product?
Thank you for your help.
-
This topic was modified 3 years, 11 months ago by
houssemhamdani.
-
This topic was modified 3 years, 11 months ago by
-
From what I know, it will not work out of the box i.e.
get custom taxonomies to create or update a product. You will have to write some custom code to achieve this, You can write this as a custom plugin that provides this functionality.If so, this would involve some custom work, but here are some links to help you:
* https://barn2.co.uk/woocommerce-custom-taxonomies/
* https://gist.github.com/themepaint/b3755d6c8d6070dac40643c6ce8210e9That last link shows very similarly how the WooCommerce Brands extension handles this.
For more help with this, we highly recommend contacting one of the services on our Customizations page https://woocommerce.com/customizations/
Hello @spraveenitpro
Thank you so much for your answer, but this didn’t work for me.
Here’s what I have when I do a GET on /wp-json/wc/v3/products with Postman:
{ "id": 1300, "name": "110 RB", "slug": "340406-002", "permalink": "https://web.sci-services.ch/shop/hygiene/soap-dispensers/110-simply-eco2-line/340406-002/", "date_created": "2020-01-29T12:07:04", "date_created_gmt": "2020-01-29T11:07:04", "date_modified": "2022-06-22T12:30:19", "date_modified_gmt": "2022-06-22T10:30:19", "type": "simple", "status": "publish", "featured": false, "catalog_visibility": "visible", "description": "<p>• Economical: controlled soap consumption<br />\n• Ideal for industrial plants/ food industry<br />\n• Key locking system<br />\n• Direct view of soap consumption<br />\n• Robust for heavy use<br />\n• Fixed with screws (supplied)</p>\n", "short_description": "<p>Soap dispenser – Refill – 700ml</p>\n", "sku": "340406/002", "price": "", "regular_price": "", "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": false, "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": false, "average_rating": "0.00", "rating_count": 0, "upsell_ids": [ 7291 ], "cross_sell_ids": [ 1299 ], "parent_id": 0, "purchase_note": "", "categories": [ { "id": 1686, "name": "110 Simply ECO2 Line", "slug": "110-simply-eco2-line" }, { "id": 21, "name": "Hygiene", "slug": "hygiene" }, { "id": 1677, "name": "Soap Dispensers", "slug": "soap-dispensers" } ], "tags": [ { "id": 1723, "name": "Simply ECO2 Line", "slug": "simply-eco2-line" } ], "images": [ { "id": 11106, "date_created": "2022-06-02T18:16:13", "date_created_gmt": "2022-06-02T16:16:13", "date_modified": "2022-06-02T18:16:13", "date_modified_gmt": "2022-06-02T16:16:13", "src": "https://www.sci-services.ch/wp-content/uploads/2018/05/320405-002.jpg", "name": "", "alt": "" } ], "attributes": [ { "id": 20, "name": "Color RAL", "position": 0, "visible": false, "variation": false, "options": [ "Grey RAL 7035" ] }, { "id": 11, "name": "Material", "position": 1, "visible": true, "variation": false, "options": [ "Backplate: 100% regenerated first choice ABS, Cover: High Impact PS - 25% recycled" ] }, { "id": 2, "name": "Color", "position": 2, "visible": true, "variation": false, "options": [ "White", "Grey" ] }, { "id": 17, "name": "Product dimensions", "position": 3, "visible": true, "variation": false, "options": [ "(WxHxD) 120x250x100 mm" ] }, { "id": 4, "name": "Consumable", "position": 4, "visible": true, "variation": false, "options": [ "Liquid soap" ] }, { "id": 14, "name": "Contents", "position": 5, "visible": true, "variation": false, "options": [ "700 ml" ] }, { "id": 15, "name": "Packing/Carton", "position": 6, "visible": true, "variation": false, "options": [ "1 pce" ] }, { "id": 16, "name": "Packing/Pallet", "position": 7, "visible": true, "variation": false, "options": [ "420 pces" ] }, { "id": 19, "name": "Range", "position": 8, "visible": false, "variation": false, "options": [ "Simply ECO2 Line" ] } ], "default_attributes": [], "variations": [], "grouped_products": [], "menu_order": 56, "price_html": "", "related_ids": [ 1298, 11782, 7304, 7291, 11781 ], "meta_data": [ { "id": 10211, "key": "_alp_processed", "value": "1580995757" }, { "id": 10262, "key": "_upsell_skus", "value": [] }, { "id": 10263, "key": "_crosssell_skus", "value": [] }, { "id": 10273, "key": "_file_path", "value": "" }, { "id": 11165, "key": "_wpml_location_migration_done", "value": "1" }, { "id": 31232, "key": "_product_url", "value": "" }, { "id": 31233, "key": "_button_text", "value": "" }, { "id": 40493, "key": "_last_release", "value": "field_5ab6e7648d8b6" }, { "id": 40494, "key": "slide_template", "value": "default" }, { "id": 40496, "key": "_yoast_wpseo_primary_product_cat", "value": "" }, { "id": 40497, "key": "_wpb_vc_js_status", "value": "false" }, { "id": 40498, "key": "_wpml_media_duplicate", "value": "1" }, { "id": 40499, "key": "_wpml_media_featured", "value": "1" }, { "id": 48358, "key": "_max_variation_sale_price", "value": "" }, { "id": 48359, "key": "_min_variation_sale_price", "value": "" }, { "id": 48360, "key": "_max_variation_regular_price", "value": "" }, { "id": 48361, "key": "_min_variation_regular_price", "value": "" }, { "id": 48362, "key": "_max_variation_price", "value": "" }, { "id": 48363, "key": "_min_variation_price", "value": "" }, { "id": 48364, "key": "last_release", "value": "20.04.18" }, { "id": 66965, "key": "_wpml_word_count", "value": "{\"total\":41,\"to_translate\":{\"fr\":41,\"de\":41,\"it\":41}}" }, { "id": 99453, "key": "_wpml_featured_image_as_translated", "value": "0" }, { "id": 100120, "key": "_yoast_wpseo_post_image_cache", "value": [] }, { "id": 132599, "key": "document", "value": "https://www.sci-services.ch/fr/simply-eco2-brochure/" }, { "id": 132600, "key": "_document", "value": "field_628e4b7a35d6b" }, { "id": 132601, "key": "matiere", "value": "verre" }, { "id": 132602, "key": "_matiere", "value": "field_6291df575302d" }, { "id": 132603, "key": "Line", "value": "Simply ECO2 Line" }, { "id": 132604, "key": "_Line", "value": "field_62947a6ae3fb1" }, { "id": 132605, "key": "Refill/cartridge", "value": "Refill" }, { "id": 132606, "key": "_Refill/cartridge", "value": "field_62947cea047c8" }, { "id": 132607, "key": "Content", "value": "350 ml" }, { "id": 132608, "key": "_Content", "value": "field_6298c250ee7e5" }, { "id": 132609, "key": "operation", "value": "Manual" }, { "id": 132610, "key": "_operation", "value": "field_6298c275ee7e6" }, { "id": 132611, "key": "fifu_image_url", "value": "https://www.sci-services.ch/wp-content/uploads/2018/05/320405-002.jpg" }, { "id": 138679, "key": "functionFunction", "value": "Soap dispenser" }, { "id": 138680, "key": "_functionFunction", "value": "field_62b2e97e770e3" } ], "stock_status": "instock", "has_options": false, "translations": { "de": "5393", "en": "1300", "fr": "5399", "it": "7594" }, "lang": "en", "_links": { "self": [ { "href": "https://web.sci-services.ch/wp-json/wc/v3/products/1300" } ], "collection": [ { "href": "https://web.sci-services.ch/wp-json/wc/v3/products" } ] } },There’s a custom post type named “product lines” that I see in the admin panel but not here.
-
This reply was modified 3 years, 11 months ago by
houssemhamdani.
-
This reply was modified 3 years, 11 months ago by
The topic ‘REST API & CPT UI’ is closed to new replies.