Checkout Button Disappears Once Variant Is Chosen

  • Posts: 75
  • Thank you received: 7
2 years 9 months ago #339377

-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.10.3
-- PHP version -- : 7.4.27
-- Browser(s) name and version -- : Firefox 96.0.3

I notice that when a variant is chosen from the dropdown on the product display page that my Checkout button at the bottom of the right side column then disappears.

It must have been this way for a long time and I never saw it until now. You can still add to cart as normal, and then customers have been getting to checkout from the mini-cart module, but the button itself is missing.

Going to another product will return the Checkout button, but choosing any variant will remove it.

I can't see what has been done to cause this, but I track the code to the 'product/show_default.php' view, where I see this:


<?php }
	if(empty ($this->element->characteristics) || $this->params->get('characteristic_display')!='list'){ ?>
		<div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main">
			<?php
			$this->row = & $this->element;
			$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';
			$this->setLayout('quantity');
			echo $this->loadTemplate();
			?>
			<a id="checkoutbut" class="btn" href="/checkout">Checkout</a>
		</div>
	<?php } ?>


I cannot quite figure out what to do here. Is there some modification of this code which will allow the checkout button to remain once a variant is chosen?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 9 months ago #339378

Hi,

I couldn't access the URL you provided:
i.imgur.com/tfGJe7Y.png
However, I checked some other products you have (they didn't have variants, unfortunately), and I think that the issue is that you added your checkout button in the show_default.php after the code

$this->setLayout('quantity');
			echo $this->loadTemplate();
but you didn't do the same modification in product / show.php where the variant HTML is generated. So when you switch the variant, the HTML of the area in the div hikashop_product_quantity_main is replaced by the HTML of the selected variant generated by product / show.php and thus the button is missing from it.

The following user(s) said Thank You: wildweststudios

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

  • Posts: 75
  • Thank you received: 7
2 years 9 months ago #339385

You were exactly right. The button was missing from 'show.php'.

Once I added it to that view now the problem is solved.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.065 seconds
Powered by Kunena Forum