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

Conversation

@emdashcodes
Copy link

This PR makes two updates to the product/variations endpoints:

  • If no position is provided and no featured image is set, the first image is set as a product's featured image. This solves the problem I was having. You can still manually include positions like before.
  • Placeholder image is removed from the API response for products and images to make it easier to detect when no images are found.

…t image as a product's featured image. This also removes the placeholder image from the API response.
if ( has_post_thumbnail( $variation->get_id() ) ) {
$attachment_id = $variation->get_image_id();
} else {
$attachment_id = current( $variation->get_gallery_image_ids() );
Copy link
Contributor

Choose a reason for hiding this comment

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

By default product variations does not have galleries, this will be supported now on core?

@claudiosanches
Copy link
Contributor

I still think that we could complete remove position, there is no real usage for it besides the featured image.

@emdashcodes
Copy link
Author

emdashcodes commented May 31, 2017

@claudiosanches Okay completely removed position, which means I've put the updated schema in this PR as well, and fixed the variations function.

Copy link
Contributor

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

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

Looks great :)

@emdashcodes emdashcodes merged commit aa29c97 into master May 31, 2017
@emdashcodes emdashcodes deleted the update/product-and-variation-images branch May 31, 2017 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants