How to get shipping ids

  • Posts: 1119
  • Thank you received: 114
3 years 3 weeks ago #305964

Hi,

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);
 var_dump($shipping);

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?

Thanks

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

  • Posts: 75479
  • Thank you received: 11747
  • MODERATOR
3 years 3 weeks ago #305969

Hi,

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.051 seconds
Powered by Kunena Forum