Solved

Help Needed: ProductReorderMedia Mutation Not Working as Expected

huangcong12
Shopify Partner
10 0 0

Hello,

I use GraphQL to perform various tasks, and usually, everything works as expected.

 

However, when I use the following API to reorder the positions of media images for a product: ProductReorderMedia, it doesn't seem to work as expected.

 

Let me demonstrate:

Initially, the order of the product images is as shown in the picture:

 

huangcong12_3-1717403998242.png

I try to change the order of these 4 images from: 1, 2, 3, 4 to: 4, 3, 2, 1, and wait for the task to complete.

 

huangcong12_4-1717404021645.png

 

 

After the execution, we expect the white cat to be in the first position, the black cat to be in the last position, and the two flower images to swap places.

However, this is not the case; only the images in positions 2 and 4 have swapped places.

huangcong12_5-1717404053539.png

 

I have tried many times, including setting the newPosition values to very high numbers, assigning newPosition to even numbers only, and changing the order of only 2 images at a time, but I have not been able to get the expected result.

 

I am not sure what went wrong and would appreciate any advice on how to solve this issue.

Thank you!

ImgCraft: AI Sharp & Resize - Rescuing Low-Quality Images | LitaCat: Page Watermark - Convey Your Voice
Accepted Solution (1)

Eric-HAN
Shopify Partner
53 8 3

This is an accepted solution.

Hi, there

 

I think the starting index should be 0, not 1 .
In my side ,this is correct.

- Helpful? Please hit Like and mark it as a solution
- Feel free to contact me iyouandhim@gmail.com

View solution in original post

Reply 1 (1)

Eric-HAN
Shopify Partner
53 8 3

This is an accepted solution.

Hi, there

 

I think the starting index should be 0, not 1 .
In my side ,this is correct.

- Helpful? Please hit Like and mark it as a solution
- Feel free to contact me iyouandhim@gmail.com