• Resolved apb1963

    (@apb1963)


    $ wp wc product_cat update 41 –image=12266.jpg
    Error: Invalid parameter(s): image {“status”:400,”params”:{“image”:”image is not of type object.”}}

    I’m not sure what that’s telling me, as a user. The only thing I can think of is the file either doesn’t exist, or is corrupt. Clearly, it exists:
    $ ls -l /data/local/src/dragon.greetonix.com/wp-content/uploads/2018/03/12266.jpg
    -rw-rw-r– 1 apb apb 201392 Mar 21 12:58 /data/local/src/dragon.greetonix.com/wp-content/uploads/2018/03/12266.jpg

    And since I’m using the same image for both product and category, I can see that the image is fine as a product, so clearly it’s not corrupt.

    So, I’m stuck as to what the issue is. Any help?

    Thanks in advance!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    It’s looking for an object. So this if the image ID already exists on your site:

    wp wc product_cat update 36 --image="{id: 186}" --user=1

    Or this if is is offsite and needs to be imported:

    wp wc product_cat update 36 --image="{src: 'https://example.dev/path/to/image.png'}" --user=1

    • This reply was modified 6 years, 8 months ago by Caleb Burks.
    Thread Starter apb1963

    (@apb1963)

    Thank you for that, I presume it will work though I’ve yet to get through it. Working on getting the image ID after the fact and running into issues.

    Also, please note, the documentation states:

    –image

    Image data.

    Which is less than useful. There’s no possible way to get from what’s written in the docs to your provided solution; until now.

    Caleb, neither of those methods worked for me.

    I uploaded the image to the media library and grabbed it’s id from the URL in the Attachment Details. I then used the id of the product category, again from the URL.

    This was my command:

    wp wc product_cat update 134 --image="{id: 9975'}" --user=1

    And WP CLI reported: Success: Updated product_cat 134.

    When I refresh the product categories page, or edit that category, the new image isn’t there.

    I’ve also got to agree with apb1963. The documentation is really in need of some examples and additional detail.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error: Invalid parameter(s): image’ is closed to new replies.