Duplicating a product through the GraphQL API doesn't always transfer the images correctly.

I’m developing a private app for a client, and one of the things I need to do is be able to completely duplicate a product. Shopify provides a GraphQL mutation for this, and it has a parameter called includeImages. It looks like this:

const DUPLICATE_PRODUCT_QUERY = `
    mutation duplicateProduct($id: ID!, $title: String!) {
        productDuplicate(productId: $id, newTitle: $title, includeImages: true) {
            newProduct {
                id
            }
        }
    }
`;

This usually works, but fairly often it doesn’t actually succeed and the duplicate product has no images

I’m not modifying the product images anywhere else. Is this a bug on my end, or is it a Shopify problem and I should find another solution?

1 Like