Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Conversation

@emdashcodes
Copy link

@emdashcodes emdashcodes commented Jun 29, 2017

Fixes #18.

Because of how some of the inheritance works, the variations image upload code was calling the wrong code path -- where we wanted this bit of code to run, the v2 code for set_product_images was running instead, since WC_REST_Dev_Product_Variations_Controller now extends WC_REST_Product_Variations_Controller.

To fix this, I'm introducing a proper set_variation_image which differs a bit anyway. Variations only support one image, not an array of images, so we would never want to set a gallery of images.

This wasn't caught by our tests because setting a product image via URL still worked. If you try to set it via ID (which should be valid), it would fail. You can see this if you run the new included test without the other changes.

To test:
Run phpunit and make sure all tests pass.

@emdashcodes emdashcodes self-assigned this Jun 29, 2017
@emdashcodes emdashcodes requested a review from ryelle June 29, 2017 16:45
@emdashcodes emdashcodes force-pushed the fix/variation-image-upload branch from d287a29 to c1cf699 Compare June 29, 2017 16:47
@emdashcodes emdashcodes force-pushed the fix/variation-image-upload branch from c1cf699 to 4b6d21e Compare June 29, 2017 16:59
Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests pass, and I was able to set a variation image by ID via the API 👍

@emdashcodes emdashcodes merged commit 0e70f3b into master Jun 29, 2017
@emdashcodes emdashcodes deleted the fix/variation-image-upload branch June 29, 2017 17:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variation image setting doesn't work

3 participants