function custom_product_price($price, $product) { // Change the price for product with ID 46 if ($product && $product->get_id() === 46) { $price = '500.00'; // Set the desired price } return $price; } add_filter('woocommerce_get_price_html', 'custom_product_price', 10, 2); add_filter('woocommerce_cart_item_price', 'custom_product_price', 10, 2); add_filter('woocommerce_cart_item_subtotal', 'custom_product_price', 10, 3);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter