Hide same address checkbox if weight is zero

  • Posts: 190
  • Thank you received: 9
4 years 4 months ago #313643

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.13
-- PHP version -- : 7.2

Hi there,

I have books and ebooks.
I want to remove the shipping for ebooks.
So i set force shipping to no
Added weight to the real book.

Now i have no shipping option if i set the address but the checkbox is still there.
I want that checkbox for the book but not the ebook.
www.dropbox.com/s/hfmubgst7iafetq/Scherm...%2011.37.43.png?dl=0

Love to know how to disable it.

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

  • Posts: 190
  • Thank you received: 9
4 years 4 months ago #313644

Also i can imagine that the full address of the invoice could be gone.
So is it possible to create an other checkout for virtual products?

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

  • Posts: 81511
  • Thank you received: 13065
  • MODERATOR
4 years 4 months ago #313671

Hi,

On the new address creation form, to avoid that, you can change the line:

if(!empty($this->options['same_address']) && !empty($this->options['new_address_type'])) {
to:
if(!empty($this->options['same_address']) && !empty($this->options['new_address_type']) && ($this->options['new_address_type'] == 'shipping' || $this->options['show_shipping'])) {
in the file show_block_address via the menu Display>Views.
For the registration form, you can add the code:
$checkoutHelper = hikashopCheckoutHelper::get();
		if(!$checkoutHelper->isShipping()) {
			$params['same_address'] = 0;
		}
after the code:
if(!isset($params['same_address_pre_checked']))
			$params['same_address_pre_checked'] = 1;
in the file administrator/components/com_hikashop/helpers/checkout/login.php
We'll add both changes on our end for the next version of HikaShop.

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

  • Posts: 190
  • Thank you received: 9
4 years 4 months ago #313677

Awesome!

One thing is if somebody has hardcover and eBook and deletes the hardcover it does not disappear.
Not big issue and that is not ajax of course :-D

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

  • Posts: 81511
  • Thank you received: 13065
  • MODERATOR
4 years 4 months ago #313678

Hi,

Yes, I see what you mean. We could add something for that. But I would say that it doesn't help much and it adds refreshing ajax requests for something that's almost never needed. So let's reduce CO2 for the planet and not do it, at least for now :)

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

Time to create page: 0.066 seconds
Powered by Kunena Forum