We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Shop

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();
Jared Buttars

Jared Buttars 1 points

  • 1 year ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

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.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

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