Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    In functions.php:

    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
    
    add_action( 'woocommerce_after_add_to_cart_button', 'woocommerce_template_single_price' );
    Thread Starter sibivfl

    (@sibivfl)

    Thanks Mike, but it doesn’t work.

    After I put this code into my function.php file I see some changes, but not what I was looking for:

    – price went under the add to card button
    – 1 in stock sentence get to the top – next to the title (it doesn’t look good as well)

    Any other ideas? I left it after changes, so you can check this out. I show you a screenshoot from my laptop as well.

    https://oi63.tinypic.com/2ebzals.jpg

    thanks

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    The above snippet moved the price in the html to be right after the button. You need some custom CSS to make it look exactly how you would like though. Something like this:

    .product form.cart div[itemprop="offers"] {
    	float: right;
    }
    
    .product form.cart div[itemprop="offers"] p.price {
    	margin-top: -4px !important;
    }

    If you aren’t comfortable with custom code, consider hiring a developer for customizations like this:

    https://jobs.wordpress.net/
    https://codeable.io/

    Thread Starter sibivfl

    (@sibivfl)

    thank you, that was helpful. problem resolved.

    Hi Caleb,

    I attempted to use your code into my site (https://www.parfournir.com/shop/trousers/athletic-fit/plain-front/), but it didn’t appear to work.

    The price, stock message, add to cart button, and quantity were all shifted over to the right instead of the add to cart button and quantity buttons moving onto the same line and to the right of the price and stock message.

    Would you be able to assist?

    Just an update – I think I’ve been able to shift the ‘Add to Cart’ button and the text box of the quantity object, but the plus and minus buttons for the quantity object disappear. Any idea on what I’m doing wrong?

    The code I’m using right now is:

    div.single_variation_wrap {
    width: 120%;
    display: -webkit-inline-box;
    }
    
    div.woocommerce-variation-add-to-cart.variations_button.woocommerce-variation-add-to-cart-enabled {
    float: right;
    padding-left: 15px;
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Price and Add to cart in the same line’ is closed to new replies.