onShippingSave no longer available?

  • Posts: 60
  • Thank you received: 4
10 months 1 week ago #330458

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.25
-- PHP version -- : 7.4

Hi

I have created a custom shipping plugin that uses the onShippingSave hook. However, something seems broken after update to 4.4.1, so I was wondering if onShippingSave was no longer available?

Merci

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

  • Posts: 74542
  • Thank you received: 11498
  • MODERATOR
10 months 1 week ago #330470

Hi,

onShippingSave is still available.
So the issue must be somewhere else.

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

  • Posts: 60
  • Thank you received: 4
10 months 6 days ago #330704

What calls onShippingSave?

Could it be a Hikashop change to onShippingDisplay or some other changes. We haven't changed anything other than updating Hikashop. onShippingDisplay contains $usable_methods with correct data, and it's rendered for the user with selectable shipping options.

The correct shipping_id and type is also saved on the order, so the information is still transferred from $usable_methods and what option is selected.

But I have no luck activating onShippingSave - any idea about where to look?

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

  • Posts: 74542
  • Thank you received: 11498
  • MODERATOR
10 months 6 days ago #330712

Hi,

onShippingSave is called when the shipping method selection is changed on the legacy checkout but that isn't the case anymore with the new checkout system.
I suppose that you were previously using the old checkout system and the 4.4.0 removing the "checkout legacy" system lead to moving to the new checkout and the mechanism you were using before doesn't work properly anymore because the saving is handled differently on the new checkout system.
The goal of that function was to check that the selected shipping method was indeed available to the customer.
However, this check is now handled directly when saving the checkout without the need to call a function of the shipping plugins as the cart system already knows what are the available shipping methods.

What you're saying seems to indicate that you were using onShippingSave for something else.
For example, maybe you were adding your own HTML to the shipping method selector with custom_html and in that case, you have the trigger onShippingCustomSave(&$cart, &$shipping, $group, $data) you can implement but this supposes that you HTML has input fields with names like checkout[shipping][custom][$group][$shipping_id][name]

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

Time to create page: 0.056 seconds
Powered by Kunena Forum