• Hi,

    I’m searching for a floating Buy Now button that I can add to individual pages and link to a product that gets added to the shopping cart (Woocommerce) I’m having trouble finding one that 1. works with WordPress 3.9.1 and 2. Is set up in the page editor of each page.

    I need to be able to control where on the page the button sits and what it is linked to for each page.

    Any suggestions welcome!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Kiwi1919

    (@kiwi1919)

    OK, So far I’ve cobbled together part of what I want to do:

    <a style="display: scroll; position: fixed; top: 33%; right: 5%; z-index: 100;" href="#" ><h5>Buy This </h5><BR><img src="https://lh6.ggpht.com/_7wsQzULWIwo/SgXYIY37QsI/AAAAAAAABDY/IyDZK-CJzdA/Up1Blue%5B4%5D.png" alt="" /></a>

    I’ve got an icon which is floating and I can control what it is in front of or behind for effect. I can control the position on the page how I want. Next I need to get the Woocommerce code for the product into the icon:

    [add_to_cart id=”23530″ sku=”woo_revo” style=”padding:10px; background:none”]

    Thread Starter Kiwi1919

    (@kiwi1919)

    Ok, nearly there! I changed href=”#” to href=”https://www.yourwebsite.com/?add-to-cart=productnumber&#8221;

    So now the button floats where I want it, adds whatever product I want to the basket BUT takes me back to the home page after adding to basket. I’d like it to take me back to the product page I was on. Hmmmm….

    BTW, By using a code snippet in the functions.php file (I added one to my child theme for safe keeping from updates etc.) you can proceed directly to check out if that’s what you want to do. From Remi Corson at wpexplorer.com: `add_filter (‘add_to_cart_redirect’, ‘woo_redirect_to_checkout’);

    function woo_redirect_to_checkout() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    return $checkout_url;
    }`

    Not quite what I want to do this time but cool any ways!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Floating Buy Now Button’ is closed to new replies.