I want to add a custom "ADD TO CART" button in the single product page.

I have done it using the id of the product.

<?php echo '<a href="?add-to-cart='.get_the_id($product_id).'">ADD TO CART</a>'; ?>

I want to add quantity, variation and attribute tags too.

so that I can get sth like:

  • please check url :stackoverflow.com/questions/43322538/… – vikrant zilpe Nov 30 '18 at 8:09
  • Thanks for the link, I have already checked it but it does not work for my example. I need to add the tags in the above link where I have already achieved to use the id tag. – Bill Nov 30 '18 at 16:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.