Only price but no add to cart button for guest, and add to cart for registerd

  • Posts: 198
  • Thank you received: 7
7 years 2 months ago #261440

-- HikaShop version -- : 3.0.0

Hi,

Is it possible to hide the add to cart buttons for guests? Only registerde users see the add to cart button.

Kind regards René

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

  • Posts: 4519
  • Thank you received: 612
  • MODERATOR
7 years 2 months ago #261445

Hello,

There is no direct options, to do that BUT there is another way to process, in 2 steps :
1°) First use price ACL in order to have price access only for registered users (or other required user groups)

Note : You will find this in products backend and PRICES AND TAXES part

2°) Switch off "Display 'add to cart' button for free products" option in your Product part (in Components => HikaShop => Configuration, and in Main tab)



This second steps, will make disapear the "free products" button, and so only registered or logged people will see the add to cart button.
Hope this will fit your needs.

Regards

Attachments:
Last edit: 7 years 2 months ago by Philip.

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

  • Posts: 198
  • Thank you received: 7
7 years 2 months ago #261533

Hi Philip,

Good suggestion but guest must see the price for guests (product can't bee free)

What i need:

Guest see a product with price X but no Add to cart button.

Registered user see special price (can be handled with ACL) but also the Add to cart button.

Can this be done hardcoded with PHP? So i can make an override for this view.

Kind regards René

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
7 years 2 months ago #261537

Hi,

In that case, I would recommend some code modification yes.
Set a price in your product for everyone, without using ACL, and, for example, for the product page, add such code at the top of the file "quantity" of the view "product":

<?php $user = JFactory::getUser(); if($user->guest) return; ?>
That will remove the display of the add to cart button and the quantity input on the product page.
Note however that if the user know the URL to manually add a product to the cart ( the one in the "HTML add to cart link" button of the product edition page), he would still be able to add a product to the cart by calling that specific URL.
But then, you can add a security and add Access levels restrictions to your payment methods so that guest users don't have any payment methods available on the checkout, and thus preventing them from finishing an order even if they were to manually call the add to cart URL.

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

  • Posts: 198
  • Thank you received: 7
7 years 2 months ago #261633

Perfect solution Nicolas thanks just what i needed!

The support of HikaShop is awesome!


Kind regards René

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

Time to create page: 0.068 seconds
Powered by Kunena Forum