Hi, I'm developing a mall script.Here is the senario. When user add item to the cart the session will store product ID. THen I've some function to display product name, price, merchant id & etc from product ID parameter. Now I want to get a shipping price base on the weight and price from database which is set by merchant. Each merchant will set different shipping rate for every 500gram.(Maximum 10kg).

The problem is, how can I determine merchant id and sum the weight base on product ID??

how can I determine merchant id and sum the weight base on product ID??

Hard to say without knowing the table structures you're using.