Changing user groups before completing a sale

  • Posts: 256
  • Thank you received: 21
10 years 1 month ago #174724

-- HikaShop version -- : 2.3.0

I have another requirement thrown at me from left field. My client wants to charge no shipping to customers who provide an employee number.

Ignoring how we verify the input for now, I'm thinking this would most likely be a custom address field so it is stored for future reference and possibly change the user group to one that gets free shipping when the field is completed. Does anyone have any alternate suggestions or see any insurmountable issues with this approach?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 1 month ago #174750

Hi,

Yes you can indeed use an address custom field, then you will have to create a plugin based on the function "onBeforeAddressCreate(&$element,&$do)" and do some PHP check regarding the custom field value, and if checks are ok you change the user group.

Here is some documentation for the plugins:
hikashop.com/support/support/documentati...r-documentation.html

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

  • Posts: 256
  • Thank you received: 21
9 years 11 months ago #182829

I've just come back to this and realised my approach needs to change. What I really need to do is add two required text fields to the manual shipping plugin (or more accurately to a new plugin copied from the manual plugin). Essentially i need an employee number to be entered tyo allow a reduced shipping amount.

As Custom Fields are not available for shipping plugins, what would be the best way to do this?

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

  • Posts: 13201
  • Thank you received: 2322
9 years 11 months ago #182845

Hi,

Add a custom order field, this way when on the checkout he can fill the field, and in the plugin you can check the content of the fields, if values are correct so change the user group.

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

  • Posts: 256
  • Thank you received: 21
9 years 11 months ago #182948

Hi Xavier, unfortunately this is not an option because we only want the fields to apply to 1 of the two shipping methods available. An ideal option would be a custom field attached to a shipping method but Hikashop doesn't support that at the moment so the alternative is to add the fields directly to the shipping plugin.

Background - The site has two user groups (representing two corporate clients, each with multiple cost centres with their own accounts). Free shipping is being offered to employees of one of these customers for personal shopping only but as they will either be logging in using the employers login or creating a new account defaulting to the same user group we need the employee and cost centre codes to be completed only for those employee purchases - hence an employee "free shipping" plugin to be validated on the custom fields that only apply to that shipping method.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 11 months ago #182972

Hi,

Or use as said a custom order field, but add some javascript to hide it based on the shipping method selection.
If desired shipping method, display the field, else hide it, and do all the checks in the plugin.

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

Time to create page: 0.072 seconds
Powered by Kunena Forum