Joel
Joel

Reputation: 895

woocommerce landing page: how to add an add to cart button

I'm building this page for a client: http://alliedscientificpro.com/lp/lightingpassport.php

It is a simple HTML, NON WORDPRESS landing page. So there is no wordpress code, no Woocommerce code, etc. Just a custom built html page, made to look like the site.

What is the best way to have my "add to cart" button work, and go directly to the cart page? Something like http://alliedscientificpro.com/cart?productid=876&qty=1" ?

Right now, as it is, it just refresh the page and nothing happens. Is there a way to just send an ajax request or direct URL to the cart page like "http://alliedscientificpro.com/cart?productid=876&qty=1" that i could use to quickly add a product without having to build my landing pages inside wordpress / woocommerce?

Thank you, I've been at this for 2 weeks now, so helps would be amazing.

Upvotes: 0

Views: 1604

Answers (2)

Mtxz
Mtxz

Reputation: 3879

You can make a link that will add to the cart from a product ID passed as a URL parameter.

Check this out.

eg: href=”https://yourdomain.com/?add-to-cart=25&quantity=3″

There's many more example at the link, including redirects.

You could also make an Ajax add to cart button, many tutorials out there.

Upvotes: 0

Jaagup Viil
Jaagup Viil

Reputation: 1

You could add the cart link to the href attribute of the button. If your link varies use JS/JQuery to build the link address and then redirect it to there.

Upvotes: 0

Related Questions