I have tried to move the product price in a simpel product overview, created with the product grid, to the top-right corner.
After searching quite a lot I found another thread with a code that I should add to the functions.php of my child theme, but it still doesn’t work.
I’m referring to: https://kriesi.at/support/topic/change-the-position-of-a-div-in-the-woocommerce-product-grid/
I used the code:
// Price Position start adjustment
function add_custom_price_pos(){
?>
<script>
jQuery(window).load(function(){
jQuery('span.amount').each(function() {
var movePrice = jQuery(this);
movePrice.prev().append( movePrice.html() );
jQuery(this).parents('.inner_product').find('.thumbnail_container').append('<span class="price">'+'<span class="amount">'+movePrice.html()+'</span>'+'</span>');
console.log('Price is :' + movePrice.html());
});
});
</script>
<?php
}
add_action('wp_footer', 'add_custom_price_pos');
What should I do to solve this?
Never mind, I’ve got it solved by using:
// custom script
add_action('wp_footer', 'ava_custom_script');
function ava_custom_script(){
?>
<script>
(function($){
function h() {
$('#top .product').each(function() {
var price = $(this).find('.price'),
thumb = $(this).find('.thumbnail_container');
price.appendTo(thumb);
});
}
h();
})(jQuery);
</script>
<?php
}