Posts form with AJAX request – Plugin development

Post without AJAX is working perfectly fine, but with AJAX, it’s returning 0. Simply put, that’s because your AJAX request doesn’t include the pp_submit input which is required by pp_html_process() — the callback for both regular and AJAX form submission. I.e. As I said in the comments: jQuery doesn’t serialize submit button value (see here), … Read more

Include external po file for 3th party plugin to theme

If discussed plugin already uses load_plugin_textdomain() function to load its translations, usually it is enough to place <plugin_name>-<locale_code>.mo file to the wp-content/languages/plugins directory. If it doesn’t (or you can’t do it for some reason), you can use init hook to load its translation via your functions.php. Here is an example from one of my child … Read more

Remove Zero Money From Previews Order woocommerce

You can update new price using below method – $order_id = 123; $order = wc_get_order( $order_id ); foreach( $order->get_items() as $item_id => $item ){ $new_product_price = 30; $product_quantity = (int) $item->get_quantity(); $new_line_item_price = $new_product_price * $product_quantity; $item->set_subtotal( $new_line_item_price ); $item->set_total( $new_line_item_price ); $item->save(); // Save line item data } $order->calculate_totals();