Custom Price doesn't work
-
I’m using this plugin for custom donation function for one of my client.
This is working fine a few weeks ago until they have updated several plugins and WordPress.This is the product link: https://www.rockpool.com/rockpoolfoundation/product/donation/
The issue is the custom field “Donation Amount” always returns 0.
This is the code I’m using:
/* Custom donation amount */ add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' ); function add_custom_price( $cart_object ) { $product_id = 187; foreach ( $cart_object->cart_contents as $key => $value ) { $all_fields = apply_filters( 'wccpf/load/all_fields', $product_id ); foreach ( $all_fields as $fields ) { foreach ( $fields as $field ) { if( $field["name"] == "donation_amount" ) { //change the price $value['data']->price = WC()->session->get( $value['wccpf_unique_key'].$field["name"] ); } } } } }
Anyone can help me? Thank you in advance!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Custom Price doesn't work’ is closed to new replies.