We’re trying to replace a Shopify Script with a Shopify Functions app but battling to see how to achieve the same functionality, or even find out if it is possible.
In simple terms the Shopify Script that we have in place currently calculates a shipping rate based on the total cost of the items in the cart excluding products that have a certain tag and after any discounts have been applied to the cart, and it then applies a set shipping rate based on that new total (instead of the actual cart total).
Simple example, if the cart contains:
- Item A - $100
- Item B - $100
- Item C - $100 (tagged to be excluded from shipping calculations)
And there is, let’s say, a 10% discount applied to the order:
- Initial total: $300
- Total excluding Item C: $200
- New total with discount: $180
Now we use $180 as a total to work out which shipping rate should then be applied to the checkout.
Looking into the Shopify Functions API’s it seems that all we are really able to do is manipulate existing shipping rates (rename, reorder or hide etc.) and not actually calculate a new shipping rate.
Does anyone have any insights on this that they wouldn’t mind sharing?