Unable to add Child Product to Cart


#1

I went through the process of creating variations for sizes of a base product and the appropriate modifiers (slug append and sku_builder) also managed to build the products. Each product has its own ID and I can see the child products in the dashboard and when I make a call to /v2/products however when trying to add one of the child products to a cart I get a 500 Internal Server Error:

‘There was an internal server error, you can report with your request id.’

Adding one of the parent products to the cart works perfectly fine. When adding child products to the cart should I be using the child products ID?

Thank you


#2

Hi @JDoz

Could you provide the ID of your base product please?

Thanks,
James


#3

The base product id is:
da8406f6-cd10-4610-919c-408986dc9ecc

Thanks


#4

Thanks @JDoz, we’ve replicated your issue and are looking into it now.


#5

@JDoz - fix has been deployed.

tld;dr - cart was not accepting child products with custom modifications.

We [meaning me] recently pushed updates to catalogue to silo code around adding products to cart in preparation for a new feature. The new code was intended to be completely compatible with current behaviour but the scenario of child products that had further custom modifications applied (where you go and directly edit a property like description or SKU on a child product) was unfortunately overlooked.

This has now been rectified. All apologies for the inconvenience.

Regards,

Ian


#6

Perfect! It is working now. I just want to confirm that the way the children were created is correct? Is there a way to create the children (variations by size) that is more efficient?


#7

@JDoz looking at your data I’m going to say yes but with the caveat that it focusses around how you set up your modifiers and how they interact with the properties on the base product.

I can see that you have edited child products to set their names and some other properties that perhaps didn’t need to be set. The only requirement for variation options to be applied are that the child product’s generated SKU and slug are unique - if you plan your SKU and slug data accordingly you get have these generated correctly without the need to go in in edit them directly - overwriting the values generated by the modifiers attached to variation options.

Hopefully you’ve food for thought enough from this thread but its always worth revisiting the blog posts around this - Intro to Variations and Modifiers


#8

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.