Get Shipping data before Chekout

  • Posts: 18
  • Thank you received: 2
8 years 10 months ago #244078

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.6

I use shipping methods which are restricted to specific postal codes. The postal code is the first thing the user has to provide when he enters the site.

I now have to show the shipping price with tax when the cart is created (before checkout). I can get the appropriate shipping method, but I'm unable to get the full price with tax, or the shipping price entered in the backend product form (some variants have different shipping prices).

In the product/cart.php Template I get the usable shippings this way:

		$fakeAddress = new stdClass();
		$fakeAddress->address_post_code = JFactory::getApplication()->getUserState(HIKASHOP_COMPONENT . '.postalcode');
		
		$cartClass = hikashop_get('class.cart');
		$cart = $cartClass->loadCart($row->cart_id);
		$cart->shipping_address = $fakeAddress;
		
		$shippingClass = hikashop_get('class.shipping');
		$rates = $shippingClass->getShippings($cart);
		
		//print_r($rates);

Last edit: 8 years 10 months ago by Head.

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

  • Posts: 12953
  • Thank you received: 1778
8 years 10 months ago #244080

Hello,
If you succeed to retrieve available shipping methods based on your customer post code, then a solution can be to directly retrieve your shipping price by checking the "hikashop_shipping_price" table.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum