joomlavirtuemart

Remove 'add to cart' button on all Virtuemart views except in productdetails


I have created a custom plugin. I want a buyer should only be able to 'add to cart' using these created fields, only on productdetails view. Until then, no add to cart button should be displayed. I also achieved this using javascript via a system plugin, though I am looking for a more better solution, as removing it via some function like - plgVmOnDisplayProductFEVM3 or something else. As a different templace could have different class for 'addtocart-bar'

I would also like to know is there anyhow we can remove 'quantity-box' and 'quantity-control' only, from 'addtocart-bar'


Solution

  • I am able to replace virtuemart 'add to cart' button. I am able to achieve it by help from Studio42 on virtuemart forum, discussion on this url.

    The following set of code, with php only will work:

    //this will remove 'addtocart' button, but show 'choose a variant', 
    // and also show quantity selector
    $product->orderable = false;
    
    //this along with above line of code will totally replace it 
    //with your own button
    $product->addToCartButton = '<div>my own button</div>';