Select the most expensive shipping method when several products are in the cart

  • Posts: 22
  • Thank you received: 5
  • Hikashop Business
11 months 3 weeks ago #356980

Hi,
I need to charge to the customer only one shipping method when he chooses several products with different shipping costs, applying only the most expensive one.

For example, the customer orders three items:
Item 1: shipping cost 4 €
Item 2: shipping cost: 4 €
Item 3: shipping cost 6 €

I'd like to have the customer pay only 6 € of shipping for all the items, only once.
Note: shipping costs have been set using different Warehouses.

How to do it?
Thank you
Kind regards

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
11 months 3 weeks ago #356985

Hi,

You can't do this with warehouses.
The goal of warehouses is to provide different shipping costs for different groups of products and sum the shipping costs of each group into one total shipping costs.
So first you need to undo what you did with warehouses: unselect the warehouse selection in your products and shipping method and then delete the warehouses.

There is actually no mechanism to work the way you want with the manual shipping plugin included with HikaShop at the moment.
So this would require the creation of a custom field of the table "product" via the menu Display>Custom fields, so that you could enter the shipping price of each product when you edit them in the backend. And then, a custom shipping plugin would need to be developed to take into account the value entered there for each product in the cart and use the higher one as the shipping fee.

Actually, that capability is quite easy to add on our end so we'll work to add it for the next version of HikaShop (in the 5.0.2 to be released in January).
If you want to use it right now, what you can do is to change the line:

$price += $rate_prices['price'] * $row->cart_product_quantity;
to:
if($price < $rate_prices['price'])
	$price = $rate_prices['price'];
in the file administrator/components/com_hikashop/helpers/shippingplugin.php
Then, create a manual shipping method and activate its "shipping price per product" setting.
Then, in each product, you'll have an extra "shipping prices" area where you can enter the shipping price for the current product.
Without the code change, HikaShop would use the sum of the shipping price of each product in the cart. With that change, it will only use the highest.
We'll add an option in shipping methods to select between both modes so that no code modification will be necessary going forward.

The following user(s) said Thank You: bellaidea

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

  • Posts: 5
  • Thank you received: 4
  • Hikashop Business
2 months 2 days ago #363328

Hello Nicolas
I have the same requirement as the OP - can you please advise on the status for the change on your side - has it been included into the code?

I don't find the mechanism for switching\choosing which mode to use (Sum of the items costs Versus Highest cost in the cart)

Many thanks
Len

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

  • Posts: 5
  • Thank you received: 4
  • Hikashop Business
2 months 2 days ago #363329

Mea-Culpa - 100% PICNIC issue (Problem In Chair Not in Computer)

I realised what I did wrong in my preproduction site - to my embarrassment:oops: :oops:

Many thanks for your ongoing works

The following user(s) said Thank You: nicolas

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

  • Posts: 5
  • Thank you received: 4
  • Hikashop Business
2 months 1 day ago #363363

Hello Nicolas

Unfortunately I am still experiencing an issue - after activating the setting for "Select the Highest Shipping Price"

My shipping method price is set at 8.50

When I add an item which has a higher shipping price defined at the product - the shipping is calculated at the 8.50 + the Product shipping of 12.50 and shows the value as 21.00

Any ideas where my mistake is ?

I am using HikaShop Business 5.1.1 [2409191121]

Attachments:

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
2 months 6 hours ago #363370

Hi,

I don't see a problem with your screenshots.
As I said 9 months ago:

Without the code change, HikaShop would use the sum of the shipping price of each product in the cart. With that change, it will only use the highest.

So, if you have a shipping method with a price of 5€, and that you have two products in the cart, one with a shipping price of 1€ and one with a shipping price of 2€, the total shipping cost will be calculated at 5+2=7€ instead of 5+2+1=8€.

There is no option where the base shipping price of the shipping method is ignored.
If you don't want that, then just set a base shipping price of 0 in the shipping method, and set that shipping price in each product for which there is is no extra cost than what you had as a base shipping price.

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

Time to create page: 0.077 seconds
Powered by Kunena Forum