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 ); } Quote Link to comment https://forums.phpfreaks.com/topic/305897-wordpresswoocommerce-help-please/ 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 Quote Link to comment https://forums.phpfreaks.com/topic/305897-wordpresswoocommerce-help-please/#findComment-1554612 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.