0

1) I want to embed the woo commerce add to cart button on a non shop page. 2) I also want to change its text and replace with an image. 3) Last thing is i want to embed a variety product above this button and use the button for this.

Aleem Zada
  • 23
  • 1
  • 6

1 Answers1

0

You can create link with href="your_site.com/?add-to-cart={product_id}" - this works for simple products. If you`re using variable product - see HTML from single product page. If you have variable procut - woocommerce create a form instead a add to cart button. See parameters and create similar form where you need and submiting this form will add variable product to cart.

Maxim Sarandi
  • 643
  • 5
  • 10
  • where i can find the script for the variable product in woocommerce code??? – Aleem Zada Feb 09 '18 at 12:55
  • Hey, i found small tutorial [here](https://nicola.blog/2015/09/18/creating-custom-add-to-cart-url/). Might help you. – Maxim Sarandi Feb 09 '18 at 13:02
  • i checked it, it's nice but i want that i also show the drop down in variation, it solves the problem by adding a static url. And i want a dynamic system, where i can also select from the dropdown – Aleem Zada Feb 09 '18 at 13:18
  • Than you should know how works post_types, taxonomies, woocommerce. You should be exprienced developer. I think you will not find ready solutions or code. Looks into woocommerce template files. Also in `single-product/add-to-cart/` folder. This will best code example for you. – Maxim Sarandi Feb 09 '18 at 13:44
  • thanks for your precious time – Aleem Zada Feb 09 '18 at 13:59