Removing Product option removes price

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard Hikashop Business
1 year 2 months ago #355834

-- HikaShop version -- : 5.0.0
-- Joomla version -- : 4.3.4
-- PHP version -- : 8.2

Hello,
I have a product setup for Gift Wrap with two characteristics, Gift wrap / No Gift Wrap. once has a cost the other does not.

I have numeorus products on my site with three variants of size setup each with their own price.

In the 'root' product I have added the Gift Wrap product as an Option.

When viewing on the frontend, the product is displayed and I can change the variant and see a different price. I can also add / remove the Gift wrap option which chnages the price. All works fine.

However I now want to remove the Gift wrap option. I have tried to unpublish the Gift Wrap product, remove it as an option from the 3 variant product, but everything I try whent he gift wrap is not included the variant product price stops being displayed or added to the cart.

Examples:

Product with Gift Wrap options

Product with Gift Wrap options removed

As you can see if you change the varaint of the product the price displayed changes, ad gift wrap etc all works, but on the second link nothing is shown price wise?

How do you remove the Option and still show the variant pricing?

Thanks
Lee

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

  • Posts: 83007
  • Thank you received: 13400
  • MODERATOR
1 year 2 months ago #355836

Hi,

Check the product with options page on our demo website:
demo.hikashop.com/index.php/en/hikashop/...ct-page/with-options
As you can see, there are two prices:
- the price without options
- the price with options
When a product doesn't have options, only the price without options is displayed.
What you're describing indicates that you've removed the display of the price without options, so that only the price with options is displayed. Which means that for products without options, no price is displayed.

So the issue is a customization issue. You'll have to modify the show_default view file in order to add back the code you deleted and which is responsible for the display of the price without options on the product details page:
i.imgur.com/U6befiD.png

<!-- PRICE -->
<?php
	$itemprop_offer = 'itemprop="offers" itemscope itemtype="https://schema.org/Offer"';
?>
		<span id="hikashop_product_price_main" class="hikashop_product_price_main" <?php echo $itemprop_offer; ?>>
<?php
	$main =& $this->element;
	if(!empty($this->element->main))
		$main =& $this->element->main;
	if(!empty($main->product_condition) && !empty($this->element->prices)) {
?>
			<meta itemprop="itemCondition" itemtype="https://schema.org/OfferItemCondition" content="https://schema.org/<?php echo $main->product_condition; ?>" />
<?php
	}
	if($this->params->get('show_price') && (empty($this->displayVariants['prices']) || $this->params->get('characteristic_display') != 'list')) {
		$this->row =& $this->element;
		$this->setLayout('listing_price');
		echo $this->loadTemplate();
		
		$price = 0;
		if (!empty($this->element->prices)) {
			$price = $this->itemprop_price;
		}
	}
		?>	<meta itemprop="price" content="<?php echo $price; ?>" />
			<meta itemprop="availability" content="https://schema.org/<?php echo ($this->row->product_quantity != 0) ? 'InStock' : 'OutOfstock' ;?>" />
			<meta itemprop="priceCurrency" content="<?php echo $this->currency->currency_code; ?>" />
		</span>
<!-- EO PRICE -->

The following user(s) said Thank You: ltempest

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

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard Hikashop Business
1 year 2 months ago #355846

Nicolas,
Thanks for the reply, awesome that works, I did not think to look at my template override!

Awesome.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum