Insert product with diferent sizes and prices

I’ve been trying for a long time to find a solution for resolving my problem. I need to upgrade my code or my website and add the next possibility:

1. Insert a single product with different sizes and prices
2. When the user open ?? product and want to change the size of the product to change price

I found only this example on Google ( Example of showing different size and price )

I can’t find any PHP Code for storing that information in the database or schema structure for the database. If anyone works with this kind of system please help me with some PHP examples on Github or other examples. I have code written in PHP MySQLi and I can share some photos to see.

Thanks, everyone

could be expressed like

$cart[$product][$variant][$size] = $quantity
Sponsor our Newsletter | Privacy Policy | Terms of Service