Disable add_cart button once added for 1 unit only

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
10 years 6 months ago #187251

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.x

I have a set of 1 unit only products.

When clients add them to cart the "add to cart" button should remain gray / disabled but stupidly it remains active so I can keep adding the same 1 unit only product for life.

Where to disable this?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 6 months ago #187268

Hi,

We don't have default options for that, you will have to create a plugin based on the function "onAfterProductQuantityCheck()" in order to check if:

if( $displayErrors && $wantedQuantity > $quantity ) 
If you are in this if condition, so you can add session data to tell that this product can no more be added to cart.
www.hikashop.com/support/support/documen...r-documentation.html

Then edit the view "product / quantity" and check in the session the data for the current product, if it can't be added to cart so edit the button to display a greyed one without any actions onclick, or simply hide the button.
www.hikashop.com/support/support/documen...ize-the-display.html

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

Time to create page: 0.060 seconds
Powered by Kunena Forum