This may be more of a question then issue, I've gone through the docs and I'm not sure what else to use. I've been using array_sum and array_map to go through all products in the cart, then find a custom product attribute value and assign a shipping cost for each product, which are all then added up to a total shipping cost.
It is working, however the total amount was more then the calculation, so I stripped it back to just be equal to how many items were in the cart i.e. 5 items shipping cost is £5. It looks like configurable products are being counted twice, so if I have a simple product and a configurable product in my cart, rather than the expected £2 I have a shipping cost of £3. Below is the code I'm using:
Hello,
This may be more of a question then issue, I've gone through the docs and I'm not sure what else to use. I've been using array_sum and array_map to go through all products in the cart, then find a custom product attribute value and assign a shipping cost for each product, which are all then added up to a total shipping cost.
It is working, however the total amount was more then the calculation, so I stripped it back to just be equal to how many items were in the cart i.e. 5 items shipping cost is £5. It looks like configurable products are being counted twice, so if I have a simple product and a configurable product in my cart, rather than the expected £2 I have a shipping cost of £3. Below is the code I'm using:
I'm on Magento 2.3.2 using luma demo data and 2.6.3 of your module.