Thatch77 Posted December 11, 2017 Share Posted December 11, 2017 Ok well turns out i didnt do it correctly. Supposedly i should have done it via the hook so it changed it on all pages where price was shown (common sense i guess). Now im a little stuck editing the get_price_html to include price per label. Anyone can see where im going wrong?? add_filter( 'woocommerce_get_price_html', 'chris_price_html', 100, 2 ); function chris_price_html( $price, $product ){ $priceperlabel = 'each'; //write logic to get the perlabel here return str_replace( 'get_post_meta', 'get_post_id()'.$priceperlabel, $price ); } Link to comment Share on other sites More sharing options...
Thatch77 Posted December 12, 2017 Author Share Posted December 12, 2017 Ok well turns out i didnt do it correctly. Supposedly i should have done it via the hook so it changed it on all pages where price was shown (common sense i guess). Now im a little stuck editing the get_price_html to include price per label. Anyone can see where im going wrong?? add_filter( 'woocommerce_get_price_html', 'chris_price_html', 100, 2 ); function chris_price_html( $price, $product ){ $priceperlabel = 'each'; //write logic to get the perlabel here return str_replace( 'get_post_meta', 'get_post_id()'.$priceperlabel, $price ); } Sorry this was from an older thread, was told to make a new one. But basically i need to move the price per item next to the total price on all pages its on. So i have total price £63 for example. I need it to say £63, price per unit/item £4 or whatever Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.