Adding custom cart price with Ajax in wordpress

Try to change your add_custom_price_callback() as follows. Untested but should work. function add_custom_price_callback() { $custom_price = intval($_POST[‘p_m’]); $target_product_id = intval($_POST[‘s_o_v’]); foreach ( WC()->cart->get_cart() as $key=>$value ) { //Single product if ( $value[‘product_id’] == $target_product_id ) { $value[‘data’]->set_price($custom_price); } //For variation if ( $value[‘variation_id’] == $target_product_id ) { $value[‘data’]->set_price($custom_price); } } //to check if is work … Read more

Query Nickname rather than Display Name in custom Woocommerce plugin

I had a similar problem and solved it similar to this: add_filter(‘pre_user_display_name’,’default_display_name’); function default_display_name($display_name) { if ( isset( $_POST[‘billing_first_name’] ) ) { $display_name = sanitize_text_field( $_POST[‘billing_first_name’] ); } return $name; } I think, the new woocommerce changes the disyplay_name on every checkout to First_Name Last_Name. With the ‘pre_user_display_name’ you can change your own way.

Remove Visual Editor and P tags from WooCommerce Taxonomy Descriptions [closed]

Hope, The following code solve your problem. Add this in functions.php $tags = $_GET[‘taxonomy’]; $taxonomy_name = array(‘product_tag’,’product_cat’); if (in_array($tags, $taxonomy_name)) { add_action(“{$tags}_edit_form_fields”, ‘form_fields’, 10, 2); } function form_fields($term, $taxonomy){ ?> <tr valign=”top”> <th scope=”row”>Description</th> <td> <?php wp_editor(html_entity_decode($term->description), ‘description’, array(‘media_buttons’ => false,’quicktags’ => false)); ?> <style> .js .tmce-active .wp-editor-area{ color:black !important; } </style> <script> jQuery(window).ready(function(){ jQuery(‘label[for=description]’).parent().parent().remove(); … Read more