Target product in checkout page with a specific type
-
With this code we can alter the price for all products in the cart.
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' ); function add_custom_price( $cart_object ) { $custom_price = 10; // This will be your custome price foreach ( $cart_object->cart_contents as $key => $value ) { $value['data']->price = $custom_price; } }
I need is to alter only products with Specific custom type called ‘auction’ and not change the rest of products.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Target product in checkout page with a specific type’ is closed to new replies.