Jump to content

Wordpress(woocommerce) help please?


Thatch77

Recommended Posts

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

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.