$wdp_get_product_any_price = function ( $price, $product, $item_meta ) { if ( isset( $item_meta['nyp'] ) ) { $price = floatval( $item_meta['nyp'] ); } return $price; }; add_filter( "wdp_get_product_regular_price", $wdp_get_product_any_price, 10, 3 ); add_filter( "wdp_get_product_sale_price", $wdp_get_product_any_price, 10, 3 ); add_filter( "wdp_get_product_initial_price", $wdp_get_product_any_price, 10, 3 ); add_filter( 'wdp_save_cart_item_keys', function ( $keys ) { return array_merge( $keys, array( 'nyp' ) ); }, 10, 1 );
WooCommerce Name Your Price, by Kathy Darling Print
Created by: Alex Prokaev
Modified on: Tue, 21 Jan, 2020 at 2:49 PM
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.