Reputation: 61
I don't find how to customize my pricing in my WordPress WebShop with the WooCommerce plugin.
I would like to have:
How is this possible please?
greets Wim
Upvotes: 3
Views: 5588
Reputation: 2617
You can add this on your functions.php
// Filter on cart price
add_filter( 'woocommerce_cart_product_price' , 'custom_price', 10, 2);
// Filter on product page
add_filter( 'woocommerce_get_price_html' , 'custom_price', 10, 2);
function custom_price( $price, WC_Product $product ){
// You can store the unit as custom fields
$unit = get_post_meta( $product->id, 'unit', true );
// Then concatenate with the price
$price .= $unit;
return $price;
}
Then you have to add a custom field on each product :
Upvotes: 1