0

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:

domain.com/myproduct/?add-to-cart=100&variation_id=200&attribute_pa_colour=blue
  • 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 agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.