简体   繁体   中英

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'

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>';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM