How to get shipping ids

  • Posts: 1119
  • Thank you received: 114
4 years 1 month ago #305964


I am building custom page where it will show shipping details based on hikashop shipping zones.

How should i get all shipping ids/methods?

As example i do have this:

$id = '8';
$shippingClass = hikashop_get('class.shipping');
$shipping = $shippingClass->get($id);

This will return all shipping details of shippig method with id '8'.

Should i run query or this can be done with hikashop code itself?


Please Log in or Create an account to join the conversation.

  • Posts: 78748
  • Thank you received: 12462
4 years 1 month ago #305969


You can use that code:

$pluginClass = hikashop_get('class.plugins');
$shippingMethods = $pluginClass->getMethods('shipping');
Note that this code will only load the data of the shipping methods you created from the database. It won't process them.
So for example, if you use a shipping method like UPS or Fedex, which calculates the shipping fees dynamically based on what is in the cart and the customer shipping address,
In that case you would need to use:
$shippingClass = hikashop_get('class.shipping');
$shipping = $shippingClass->getShippings($cart);
But in that case, you need to give it the full cart in $cart which is tricky to do as it needs a whole bunch of data loaded.

The following user(s) said Thank You: kyratn

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum