0

I want to change the price of a specific product, but for an existing user or session!,but i tried to try this function, but it didn't work. Is there any solution?

function custom_change_product_price($price, $product) {
$testp=12993;
    if ($product->get_id() === $testp) {
        $new_price = $price * 1.1; 
        return wc_price($new_price);
    }
    return $price; 
}
add_filter('woocommerce_get_price_html', 'custom_change_product_price', 10, 2);
  • `woocommerce_get_price_html` only affects the display of price, it won't change the actual price when added to cart or checkout. Are you wanting to change the display of the price or the price itself? – Insula Aug 31 '23 at 16:03
  • I want to change the price, but only for the user who ordered a product! beacuse % will change depend on request – soufiane hasnaoui Aug 31 '23 at 17:31

0 Answers0