This topic has 4 replies, 2 voices, and was last updated 5 months, 1 weeks ago ago by Luca Rossi
Hello, I was kindly provided this code below to move the product price ontop of the add to cart page. But now when we use different prices for the variation’s theres 2 prices.
Is there a way to only include 1 price, but still have it show ontop of the add to cart button?
Thanks so much
add_action('wp_footer', 'n2t_wp_footer');
function n2t_wp_footer(){
if(is_singular('product')){
?>
<script>
jQuery( function($){
$(document).ready(function(){
$('[data-widget_type="woocommerce-product-etheme_price.default"]').insertBefore($("form.cart button.single_add_to_cart_button"));
})
});
</script>
<?php
}
}
Dear Carly,
We hope this message finds you well. Could you please provide further details on your objectives with the videos or screenshots you mentioned? We are currently unclear about your intentions.
Thank you for your cooperation.
Best Regards,
8Theme’s Team
Sure no problem, video attached.
When I select a variable product’s child with a different price, it displays 2 prices.
I would like the variable product price to be displayed where the prices above the add to cart button is.
Thanks
Hi @carlyliczyk,
We could see that you’ve already have this code. So please extend this a little bit.
– Change from:
// On live event (attribute select fields change)
$('table.variations select').on('blur', function() {
// variation ID is selected
if ('' != $(c).val() && $(a).text() != '') {
$(d).html($(a).html());
// We copy the variation description
}// No variation ID selected
else {
$(d).html($(a).html());
// We set back the variable product description
}
console.log($('input.variation_id').val());
// TEST: Selected variation ID … To be removed
});
– To:
// On live event (attribute select fields change)
$('table.variations select').on('blur', function() {
// variation ID is selected
if ('' != $(c).val() && $(a).text() != '') {
$(d).html($(a).html());
// We copy the variation description
}// No variation ID selected
else {
$(d).html($(a).html());
// We set back the variable product description
}
$('[data-widget_type="woocommerce-product-etheme_price.default"] .price').html($('.woocommerce-variation-price').html());
console.log($('input.variation_id').val());
// TEST: Selected variation ID … To be removed
});
Please note that any issues with the custom codes are falled outside of scope our support standard services.
Thanks for understanding!
Best Regards,
8Theme’s Team
You must be logged in to reply to this topic.Log in/Sign up