Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there!

    You can find more information about product images via the API here:
    https://woocommerce.github.io/woocommerce-rest-api-docs/#product-images-properties

    Thread Starter manigopal

    (@manigopal)

    How do I add / get product image in my orders api

    Also to display product image in my orders page web

    Thread Starter manigopal

    (@manigopal)

    @fernashes how could i get the images array in order detail API

    example.com/wp-json/wc/v3/orders/101?consumer_key=ck_xxxxxxx&consumer_secret=cs_xxxxx

    output to get with the following in orders(particular/myOrders):

    
    "images": [
                {
                    "id": 1296,
                    "date_created": "2019-03-25T20:37:03",
                    "date_created_gmt": "2019-03-25T10:07:03",
                    "date_modified": "2019-03-25T20:37:03",
                    "date_modified_gmt": "2019-03-25T10:07:03",
                    "src": "https://example.com/wp-content/uploads/2019/03/nestle-milkmaid.jpg",
                    "name": "-nestle-milkmaid",
                    "alt": "",
                    "position": 0
                }
            ],
    
    • This reply was modified 5 years, 9 months ago by Jan Dembowski.
    • This reply was modified 5 years, 9 months ago by Jan Dembowski. Reason: Formatting
    Thread Starter manigopal

    (@manigopal)

    @fernashes can you reply me on REST API extending i.e, i need to get the product image array in api

    wp-json/wc/v2/orders/4166 –

    “line_items”: [
    {
    “id”: 290,
    “name”: “Brooke Bond-3 Roses Tea”,
    “product_id”: 21,
    “variation_id”: 0,
    “quantity”: 1,
    “tax_class”: “”,
    “subtotal”: “54.00”,
    “subtotal_tax”: “0.00”,
    “total”: “54.00”,
    “total_tax”: “0.00”,
    “taxes”: [],
    “meta_data”: [],
    “sku”: “”,
    “price”: 54
    },

    in this i need to get product image

    dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hey @manigopal

    This isn’t possible out of the box through the REST API, you will want to query the product ID that is returned and request the thumbnail for that product.

    This post might help – https://stackoverflow.com/questions/30813815/show-products-image-in-orders-page-woocommerce

    Thanks,

    Thread Starter manigopal

    (@manigopal)

    if we do that might be gone at future plugin updates., so if there any code like adding them to functions.php such like add_action()

    Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    I would do the following.

    * Write a function that gets the values for you and accepts order ID as an argument.
    * Register a custom endpoint for the function. https://developer.www.ads-software.com/rest-api/extending-the-rest-api/adding-custom-endpoints/ – make sure this checks for credentials since order data should not be publicly accessible.

    Kind regards,

    AJ a11n

    (@amandasjackson)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thread Starter manigopal

    (@manigopal)

    Hi,
    but its mandatory when we develop a mobile app we do require the Product Images to be fetched / retrieved at the order to display in My Order page too at MobileApps.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Extending API’s’ is closed to new replies.