Forum
Programmatically set shipping cost
Is there a way to programmatically set the cost of shipping for a cart?
Similar to the perch_shop_add_to_cart(1234); function it would be used something like this:
perch_shop_set_shipping_total(12.95);
A bonus would the ability to programatically set a name for it as well as the ability to get the values:
perch_shop_set_shipping_type("Custom Shipping 2x");
perch_shop_get_shipping_total();
perch_shop_get_shipping_type();
There isn't a way to do that currently, no. I'll take a look at see if something like that might be feasible in a future release.
I'd like to see this implemented too. It could make it possible for us to integrate Perch Shop with something like Shippo.
I'm exploring several options, I love the Shippo suggestion from Hussein and would love to write a Shippo add-on for Perch but without a hook into setting the shipping total of a cart that isn't going to be possible. I've considered modifying the Shop code itself to support directly setting the shipping cost but really don't want to do that for so many reasons. I've considered adding a phantom product to the cart that is merely a shipping cost but that messes up reporting and some of the other brilliant built-in cart functions like product count etc.
Unfortunately a looming deadline to get this project done for a client means I might need to cross some of the wires in the Perch Shop code and keep careful track of it during Runway and Shop upgrades but that really rubs the wrong way.
Mostly thinking out loud here, but if anyone else is or has run into this please join in. :)
I'll add my voice to this. Would definitely be a great feature to see.
Another me too here